Download the PHP package hannesvdvreken/php-oauth without Composer
On this page you can find all versions of the php package hannesvdvreken/php-oauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-oauth
OAuth service classes with Guzzle (v4 and v5, but not v6)
Usage
Let's dive right in.
Setup
Some possible configuration can be passed on with the constructor, like so:
An alternative way is the following:
The service class also has the following getters:
The GuzzleHttp\Client
underneath can be accessed like so:
Requesting an API
The internal GuzzleHttp\Client
can be called by calling the same methods on the service class.
or
The internal Guzzle Client will be called with the right token in the header or GET parameter. All you need to do is load the service class with the correct credentials or tokens from your persistance layer or session.
Laravel 4
If you're using Laravel 4, feel free to register the contained service provider (OAuth\Support\ServiceProvider
).
Register the OAuth
class alias for the facade to use the following syntax to get a fully configured service class:
To create an empty config file in app/config/packages
just use the artisan command:
OAuth 1.0a
For the OAuth1.0a functionality we internally use the Guzzle OAuth1 subscriber. An example:
Or in short, the authorizationUrl
will call the requestToken
method, if you haven't done so already:
In the callback controller...
OAuth 2
The OAuth2 flow is easier.
In the callback controller...
Supported services
- Campaign Monitor
- Dropbox
- Foursquare
- GitHub
- MailChimp
- Twitter (OAuth1.0a)
- Stack Exchange
Guzzle v3
If you want to continue to work with the old versions of this library that
leveraged Guzzle v3 (Guzzle\Http\Client
instead of GuzzleHttp\Client
)
then you might want to install the 0.1.*
releases. Pull request with Guzzle v3 compatibility should be made against the guzzle3
branch. Install the latest guzzle v3 version with 0.1.*
or dev-guzzle3
.
Contributing
Feel free to make a pull request. A new service class can be as simple as 22 lines of code. Please try to be as PSR-2 compliant as possible. There's no shame if you misplaced a bracket or so!
Testing
After installing the dependencies (composer install
) you just need to run
phpunit
to run the entire test-suite.
License
MIT
All versions of php-oauth with dependencies
guzzlehttp/guzzle Version ~4|~5
guzzlehttp/oauth-subscriber Version 0.1.*