PHPackages                             leoru/laravel-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. leoru/laravel-oauth2

ActiveLibrary

leoru/laravel-oauth2
====================

Authorize users in your application with multiple OAuth 2.0 providers.

0.2.6(12y ago)5706PHP

Since May 23Pushed 11y ago1 watchersCompare

[ Source](https://github.com/leoru/laravel-oauth2)[ Packagist](https://packagist.org/packages/leoru/laravel-oauth2)[ Docs](http://github.com/madewithlove/laravel-oauth2)[ RSS](/packages/leoru-laravel-oauth2/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (7)Used By (0)

Laravel OAuth 2.0
=================

[](#laravel-oauth-20)

**This is based on the CodeIgniter OAuth2 Spark maintained by Phil Sturgeon**

Authorize users with your application in a driver-base fashion meaning one implementation works for multiple OAuth 2 providers. This is only to authenticate onto OAuth2 providers and not to build an OAuth2 service.

Note that this Spark ONLY provides the authorization mechanism. There's an example controller below, however in a later version there will be a full controller.

Installation via Composer
-------------------------

[](#installation-via-composer)

Add this to you composer.json file, in the require object;

```
"taylorotwell/laravel-oauth2": "0.2.*"

```

After that, run composer install to install Laravel OAuth 2.0.

Currently Supported
-------------------

[](#currently-supported)

- Facebook
- GitHub
- Google
- Windows Live
- YouTube
- Moves
- Runkeeper
- Vkontakte

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

[](#usage-example)

```
use OAuth2\OAuth2;
use OAuth2\Token_Access;
use OAuth2\Exception as OAuth2_Exception;

public function action_session($provider)
{
	$provider = OAuth2::provider($provider, array(
		'id' => 'your-client-id',
		'secret' => 'your-client-secret',
	));

	if ( ! isset($_GET['code']))
	{
		// By sending no options it'll come back here
		return $provider->authorize();
	}
	else
	{
		// Howzit?
		try
		{
			$params = $provider->access($_GET['code']);

        		$token = new Token_Access(array(
        			'access_token' => $params->access_token
        		));
        		$user = $provider->get_user_info($token);

			// Here you should use this information to A) look for a user B) help a new user sign up with existing data.
			// If you store it all in a cookie and redirect to a registration page this is crazy-simple.
			echo "";
			var_dump($user);
		}

		catch (OAuth2_Exception $e)
		{
			show_error('That didnt work: '.$e);
		}
	}
}
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Every ~6 days

Total

6

Last Release

4702d ago

### Community

---

Top Contributors

[![leoru](https://avatars.githubusercontent.com/u/892720?v=4)](https://github.com/leoru "leoru (11 commits)")[![taylorotwell](https://avatars.githubusercontent.com/u/463230?v=4)](https://github.com/taylorotwell "taylorotwell (11 commits)")[![andrew-s](https://avatars.githubusercontent.com/u/479306?v=4)](https://github.com/andrew-s "andrew-s (4 commits)")[![ericlbarnes](https://avatars.githubusercontent.com/u/116662?v=4)](https://github.com/ericlbarnes "ericlbarnes (2 commits)")[![crodjer](https://avatars.githubusercontent.com/u/343499?v=4)](https://github.com/crodjer "crodjer (2 commits)")[![caseyamcl](https://avatars.githubusercontent.com/u/53035?v=4)](https://github.com/caseyamcl "caseyamcl (2 commits)")[![gazoakley](https://avatars.githubusercontent.com/u/261262?v=4)](https://github.com/gazoakley "gazoakley (1 commits)")[![jonasvanschoote](https://avatars.githubusercontent.com/u/1032147?v=4)](https://github.com/jonasvanschoote "jonasvanschoote (1 commits)")[![salesan](https://avatars.githubusercontent.com/u/2605067?v=4)](https://github.com/salesan "salesan (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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