PHPackages                             chrisnharvey/oauth2 - 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/oauth2

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

chrisnharvey/oauth2
===================

Authorize users in your application with multiple OAuth 2.0 providers

345[1 issues](https://github.com/chrisnharvey/oauth2/issues)PHP

Since May 28Pushed 11y ago1 watchersCompare

[ Source](https://github.com/chrisnharvey/oauth2)[ Packagist](https://packagist.org/packages/chrisnharvey/oauth2)[ RSS](/packages/chrisnharvey-oauth2/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#oauth-20-composer-package)

*Deprecated: Use [league/oauth2-client](https://github.com/thephpleague/oauth2-client).*

Authorize users with your application using multiple OAuth 2 providers.

Supported Providers
-------------------

[](#supported-providers)

- Appnet
- Facebook
- Foursquare
- GitHub
- Google
- Instagram
- Mailchimp
- Mailru
- PayPal
- Soundcloud
- Vkontakte
- Windows Live
- Yandex
- YouTube

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

[](#usage-example)

In this example we will authenticate the user using Facebook.

```
$oauth = new \OAuth2\Provider\Facebook(array(
	'id' => 'CLIENT_ID',
	'secret' => 'CLIENT_SECRET',
	'redirect_url' => 'URL_TO_THIS_PAGE'
));

if ( ! $oauth->isAuthenticated()) {
	header("Location: {$oauth->getAuthenticationUrl()}");
	exit;
}

// Tokens
print_r($oauth->getUserTokens());

// User data
print_r($oauth->getUserInfo());
```

If all goes well you should see a dump of the users tokens and data.

### Calling OAuth 2 APIs using Guzzle

[](#calling-oauth-2-apis-using-guzzle)

You can also use this package to make calls to your respective APIs using Guzzle.

```
$client = new \OAuth2\Client('https://graph.facebook.com');
$client->setUserTokens($oauth->getUserTokens());

echo $client->get('me')->send();
```

This example should show your Facebook profile from the API along with the headers

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/oauth2) 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

21

—

LowBetter than 17% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 (37 commits)")

### Embed Badge

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

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

###  Alternatives

[vitalybaev/laravel5-dkim

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

3163.1k](/packages/vitalybaev-laravel5-dkim)[firemultimedia/mautic-multi-captcha-bundle

This plugin brings Google's reCAPTCHA, hCaptcha, and Cloudflare Turnstile integration to mautic.

151.4k](/packages/firemultimedia-mautic-multi-captcha-bundle)

PHPackages © 2026

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