Download the PHP package allovince/evaoauth without Composer
On this page you can find all versions of the php package allovince/evaoauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package evaoauth
EvaOAuth
EvaOAuth provides a standard interface for OAuth1.0 / OAuth2.0 client authorization, it is easy to integrate with any PHP project by very few lines code.
Features
- Standard interface, same code for both OAuth1.0 and OAuth2.0 different workflow, receiving token and user info as same format either.
- Fully tested
- Easy to debug, enable debug mode will record every request and response, help you find out problems quickly.
- Out-of-the-box, already supported most popular websites including Facebook. Twitter, etc.
- Scalable, integrate a new oauth website just need 3 lines code.
Quick Start
EvaOAuth can be found on Packagist. The recommended way to install this is through composer.
Edit your composer.json and add:
And install dependencies:
Let's start a example of Facebook Login, if you have already have a Facebook developer account and created an app, prepare a request.php as below:
Run request.php in browser, will be redirected to Facebook authorization page. After user confirm authorization, prepare the access.php for callback:
Once access token received, we could use access token to visit any protected resources.
That's it, more usages please check examples and wiki.
Providers
EvaOAuth supports most popular OAuth services as below:
- OAuth2.0
- Douban
- Tencent
- OAuth1.0
Creating a custom provider require only few lines code, for OAuth2 sites:
Then register to service and create instance:
Storage
In OAuth1.0 workflow, we need to store request token somewhere, and use request token exchange for access token.
EvaOAuth use Doctrine\Cache as storage layer. If no configuration, default storage layer use file system to save data, default path is EvaOAuth/tmp.
Feel free to change file storage path before Service
start:
Or use other storage such as Memcache:
Events Support
EvaOAuth defined some events for easier injection which are:
- BeforeGetRequestToken: Triggered before get request token.
- BeforeAuthorize: Triggered before redirect to authorize page.
- BeforeGetAccessToken: Triggered before get access token.
For example, if we want to send an additional header before get access token:
Implementation Specification
EvaOAuth based on amazing http client library Guzzle, use fully OOP to describe OAuth specification.
Refer wiki for details:
Debug and Logging
Enable debug mode will log all requests & responses.
Make sure PHP script have permission to write log path.
API References
Run phpdoc
will generate API references under docs/
.
All versions of evaoauth with dependencies
zendframework/zend-config Version 2.*
zendframework/zend-session Version 2.*
zendframework/zend-json Version 2.*
zendframework/zend-http Version 2.0.3
zendframework/zend-eventmanager Version 2.*
zendframework/zendoauth Version 2.0.2