PHPackages                             phantom/oauth2-social-login - 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. phantom/oauth2-social-login

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

phantom/oauth2-social-login
===========================

A simple oauth2 social login helper

0.0.1(10y ago)0481MITPHPPHP &gt;=5.4.0

Since Aug 27Pushed 10y ago1 watchersCompare

[ Source](https://github.com/flph/oauth2-social-login)[ Packagist](https://packagist.org/packages/phantom/oauth2-social-login)[ RSS](/packages/phantom-oauth2-social-login/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Oauth2 Social Login Package for Laravel 4
=========================================

[](#oauth2-social-login-package-for-laravel-4)

This package is very easy to integrate with any project that needs to login with and oauth2 client.

It implements the oauth flow:

- Log in with a social provider
- Connect an existing user record with a social provider
- Perform requests against the social provider API with each user's unique access token

Supported Services
------------------

[](#supported-services)

At this time is only implemented facebook provider.

Installation Via Composer
-------------------------

[](#installation-via-composer)

Add this to your composer.json file, in the require object:

```
"phantom/oauth2-social-login": "^0.0.2"
```

After that, run composer install to install the package.

Add the service provider to `app/config/app.php`, within the `providers` array.

```
'providers' => array(
	// ...
	'Phantom\Oauth2SocialLogin\Oauth2SocialLoginServiceProvider',
)
```

Configuration
-------------

[](#configuration)

Publish the default config file to your application so you can make modifications.

```
$ php artisan config:publish phantom/oauth2-social-login
```

Add your service provider credentials to the published config file: `app/config/packages/phantom/oauth2-social-login/facebook.php`

Basic Usage
-----------

[](#basic-usage)

You may put a link on a view that redirect the user to the oAuth log in page for a provider.

```

	Connect Your Facebook Account

```

On the controller that parse the redirect uri you defined on config request the token to the provider.

```
$code = Input::get('code');
$token = Facebook::getToken($code);
```

Once you have the token, you may do any call to the provider api you want. For instance there is a simple function to request the user own profile data.

```
$user = Facebook::getUserInfo($token);
```

#### Error Handling

[](#error-handling)

You may use try catch control to catch if something goes wrong

```
	try{}catch(Exception $exp){
		switch($exp->getCode()){
			case 401: //The provider did not provide you and access token
				break;
			case 415: //The response with user info have bad formatted data
				break;
			default: //There was a problem connecting to provider
		}
	}
```

#### Requirements

[](#requirements)

This implementation assumes that you want to allow your users to log in or sign up seamlessly with their existing social provider account and associate that social provider account with an existing user record.

#### Social Login Flow

[](#social-login-flow)

- Simply create a link to the redirect login generated url. The user will be redirected to the provider login page before they return to your website.
- If an existing user is already linked to the provider account do the log in as that user.
- If an existing user is not found for the provider account, a new user record must be created and then a link to the provider account must be made before he is logged in as that user.
- You can also associate a social provider account to an existing user if they are already logged in.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3954d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/741913?v=4)[Filipe Ferreira](/maintainers/flph)[@flph](https://github.com/flph)

---

Top Contributors

[![flph](https://avatars.githubusercontent.com/u/741913?v=4)](https://github.com/flph "flph (2 commits)")

---

Tags

laraveloauth2loginsocial

### Embed Badge

![Health badge](/badges/phantom-oauth2-social-login/health.svg)

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

###  Alternatives

[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2745.2M3](/packages/auth0-login)[mmanos/laravel-social

A social login package for Laravel 4.

556.8k](/packages/mmanos-laravel-social)[mad-web/laravel-social-auth

Easy social auth integration with a lot of available providers

516.7k](/packages/mad-web-laravel-social-auth)[kronthto/laravel-oauth2-login

Provides a middleware to protect resources requiring an OAuth2 login

2117.5k1](/packages/kronthto-laravel-oauth2-login)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2013.2k](/packages/alajusticia-laravel-logins)

PHPackages © 2026

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