PHP 5.4+ OAuth (1 and 2) client library

1.0.2 2014-08-19 15:28 UTC


php-oauth-lib provides OAuth support in PHP 5.4+ and is very easy to integrate with any project which requires an OAuth client.

Build Status Code Coverage Scrutinizer Quality Score Latest Stable Version Total Downloads


This library can be found on Packagist. The recommended way to install this is through composer.

Edit your composer.json and add:

    "require": {
        "pasadinhas/oauth": "~1.0.0"

And then update your dependencies with:

$ composer update

Extend this package

If you implement any new Service, HTTP Client or Storage, make a pull request so I can add it to this package. Don't forget to write some tests for it!


You can implement any service with custim requirements by extending and implementing the AbstractService class of the corresponding OAuth version. You will need to implement the abstract methods and should be ready to go! In order to parse the token response from OAuth2 it's recommended to use TokenParserTrait provided.

HTTP Clients

You can implement any HTTP Client you desire. Just create a class that implements OAuth\Common\Http\ClientInterface. By default a CurlClient and a StreamClient are provided.


The same for storage. Just implement the OAuth\Common\Token\TokenStorageInterface and use it in your app.

Service support

The library supports both OAuth 1.x and OAuth 2.0 compliant services. A list of currently implemented services can be found below.

Included service implementations

  • OAuth1
    • BitBucket
    • Etsy
    • FitBit
    • Flickr
    • Tumblr
    • Twitter
    • Xing
    • Yahoo
  • OAuth2
    • Amazon
    • BitLy
    • Box
    • Dailymotion
    • Dropbox
    • Facebook
    • FenixEdu
    • Foursquare
    • GitHub
    • Google
    • Harvest
    • Heroku
    • Instagram
    • LinkedIn
    • Mailchimp
    • Microsoft
    • PayPal
    • Pocket
    • Reddit
    • RunKeeper
    • SoundCloud
    • Vkontakte
    • Yammer
  • more to come! (Make pull requests if you have any!)


Examples of basic usage are located in the examples/ directory.


For usage with complete auth flow, please see the examples.

Framework Integration

  • Laravel 4: I have a package for the library. It has a Service Provider which makes using this package even easier!


To run the tests, you must install dependencies with composer install --dev