PHPackages                             chrisnharvey/oauth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. chrisnharvey/oauth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

chrisnharvey/oauth
==================

Authorize users in your application with multiple OAuth 1.0 and OAuth 2.0 providers

131094[6 issues](https://github.com/chrisnharvey/oauth/issues)PHP

Since Mar 26Pushed 12y ago2 watchersCompare

[ Source](https://github.com/chrisnharvey/oauth)[ Packagist](https://packagist.org/packages/chrisnharvey/oauth)[ RSS](/packages/chrisnharvey-oauth/feed)WikiDiscussions develop Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/ee27267c5e4bb387b4d26d451b85b95baa5d22754f6ed64d7635836b57b7c6c9/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f63687269736e6861727665792f6f617574682e706e67)](http://travis-ci.org/chrisnharvey/oauth)

OAuth Composer Package
======================

[](#oauth-composer-package)

Authorize users with your application using multiple OAuth 1 and OAuth 2 providers.

Examples
--------

[](#examples)

OAuth is split into two sections, clients and providers. A client is an application - perhaps a basic Twitter feed aggregator - which authenticates with an OAuth provider, which in this example would be Twitter itself. You can interact with any provider which is supported in the list below:

- Appnet
- Dropbox
- Facebook
- Flickr
- Foursquare
- GitHub
- Google
- Instagram
- LinkedIn
- Mailchimp
- Mailru
- PayPal
- Soundcloud
- Tumblr
- Twitter
- Vkontakte
- Windows Live
- Yandex
- YouTube

Usage Example
-------------

[](#usage-example)

In this example we will authenticate the user using Twitter.

```
$provider = \OAuth\OAuth::provider('Twitter', array(
	'id' => 'CLIENT_ID',
	'secret' => 'CLIENT_SECRET',
	'redirect_url' => 'URL_TO_THIS_PAGE'
));

$oauth = $provider->process(function($url, $token = null) {

    if ($token) {
        session_start();
        $_SESSION['token'] = base64_encode(serialize($token));
    }

    header("Location: {$url}");
    exit;

}, function() {

    session_start();
    return unserialize(base64_decode($_SESSION['token']));

});

print_r($oauth->getUserInfo());
```

If all goes well you should see a dump of user data.

Contribute
----------

[](#contribute)

1. Check for open issues or open a new issue for a feature request or a bug
2. Fork [the repository](https://github.com/chrisnharvey/oauth) on Github to start making your changes to the `develop` branch (or branch off of it)
3. Write a test which shows that the bug was fixed or that the feature works as expected
4. Send a pull request and bug me until I merge it

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance11

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/619298?v=4)[Chris Harvey](/maintainers/chrisnharvey)[@chrisnharvey](https://github.com/chrisnharvey)

---

Top Contributors

[![chrisnharvey](https://avatars.githubusercontent.com/u/619298?v=4)](https://github.com/chrisnharvey "chrisnharvey (123 commits)")[![andrew-s](https://avatars.githubusercontent.com/u/479306?v=4)](https://github.com/andrew-s "andrew-s (4 commits)")[![alexbilbie](https://avatars.githubusercontent.com/u/77991?v=4)](https://github.com/alexbilbie "alexbilbie (3 commits)")[![Compilerrr](https://avatars.githubusercontent.com/u/1644015?v=4)](https://github.com/Compilerrr "Compilerrr (3 commits)")[![mindplay-dk](https://avatars.githubusercontent.com/u/103348?v=4)](https://github.com/mindplay-dk "mindplay-dk (3 commits)")[![crodjer](https://avatars.githubusercontent.com/u/343499?v=4)](https://github.com/crodjer "crodjer (2 commits)")[![calvinfroedge](https://avatars.githubusercontent.com/u/632938?v=4)](https://github.com/calvinfroedge "calvinfroedge (2 commits)")[![it-can](https://avatars.githubusercontent.com/u/644288?v=4)](https://github.com/it-can "it-can (2 commits)")[![lexical-scope](https://avatars.githubusercontent.com/u/697620?v=4)](https://github.com/lexical-scope "lexical-scope (2 commits)")[![philmareu](https://avatars.githubusercontent.com/u/248392?v=4)](https://github.com/philmareu "philmareu (1 commits)")[![jeremyvaught](https://avatars.githubusercontent.com/u/302304?v=4)](https://github.com/jeremyvaught "jeremyvaught (1 commits)")[![psp83](https://avatars.githubusercontent.com/u/195447?v=4)](https://github.com/psp83 "psp83 (1 commits)")[![bnvk](https://avatars.githubusercontent.com/u/48677?v=4)](https://github.com/bnvk "bnvk (1 commits)")[![ckald](https://avatars.githubusercontent.com/u/204759?v=4)](https://github.com/ckald "ckald (1 commits)")[![FDiskas](https://avatars.githubusercontent.com/u/468006?v=4)](https://github.com/FDiskas "FDiskas (1 commits)")

### Embed Badge

![Health badge](/badges/chrisnharvey-oauth/health.svg)

```
[![Health](https://phpackages.com/badges/chrisnharvey-oauth/health.svg)](https://phpackages.com/packages/chrisnharvey-oauth)
```

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.3M17](/packages/kartik-v-yii2-password)[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
