Skip to content

Remove Guzzle as a dependency and allow custom HTTP clients #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2015
Merged

Remove Guzzle as a dependency and allow custom HTTP clients #224

merged 1 commit into from
Feb 25, 2015

Conversation

jeromegamez
Copy link
Contributor

This is a follow-up to #223.

Greetings!

The changes in this PR remove Guzzle as a dependency and allows developer to use their already existing HTTP client as long as it is supported by the Ivory HTTP adapter (which, as a bonus point, implements PSR-7).

In the default state, the CurlHttpAdapter is used (which only has curl as a dependency), but if a project is already using another HTTP client, it can be configured like this:

use Ivory\HttpAdapter\GuzzleHttpHttpAdapter;

$client = new \GuzzleHttp\Client(); // or any existing client
$httpClient = new GuzzleHttpHttpAdapter($client); // Guzzle 5

$provider = new League\OAuth2\Client\Provider\<ProviderName>([
    'clientId'      => 'XXXXXXXX',
    'clientSecret'  => 'XXXXXXXX',
    'redirectUri'   => 'https://your-registered-redirect-uri/',
    'scopes'        => ['email', '...', '...'],
], $httpClient);

You can find a list of supported adapters and a full usage documentation in the Ivory HTTP Adapter README.

I hope this PR receives your approval, and your feedback would be highly appreciated.

Cheers
:octocat: Jérôme

@jeromegamez
Copy link
Contributor Author

Oh, and in case you accept this PR, I will also create PRs at the 3rd party libraries currently using the 1.0 branch of the oauth2-client. As far as I can tell, that's currently only the case for the oauth2-facebook provider.

// @codeCoverageIgnoreStart
$raw_response = explode("\n", $e->getResponse());
$raw_response = explode("\n", (string) $e->getResponse()->getBody());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this has changed in recent 0.x code. I need to merge changes from master into the 1.0 branch, and then we'll see if there are any conflicts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As soon as you have merged the 0.x into the 1.0 branch, I can rebase the PR and handle conflicts, if there are any. But this PR is very similar to #223 (which I targeted at 0.x) so I have a good feeling :)

@ramsey
Copy link
Contributor

ramsey commented Feb 24, 2015

I merged master into 1.0. It now looks like your PR has some conflicts, and the 1.0 branch is now failing the build (see https://travis-ci.org/thephpleague/oauth2-client/builds/52007665).

The build failures are really on me, so I'll handle those, but it will be a day or so before I can get to them.

@ramsey
Copy link
Contributor

ramsey commented Feb 24, 2015

I fixed the build. Please rebase and see what conflicts there are.

@jeromegamez
Copy link
Contributor Author

I rebased and resolved the one conflict that the rebase produced.

@ramsey
Copy link
Contributor

ramsey commented Feb 25, 2015

Thanks!

ramsey added a commit that referenced this pull request Feb 25, 2015
Remove Guzzle as a dependency and allow custom HTTP clients
@ramsey ramsey merged commit b956774 into thephpleague:1.0 Feb 25, 2015
@jeromegamez jeromegamez deleted the feature/http-adapter-1.0 branch February 25, 2015 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy