Skip to content

joshuaziering/oauth-4-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OAuth wrapper for Laravel 4

oauth-4-laravel is a simple laravel 4 service provider (wrapper) for Lusitanian/PHPoAuthLib witch provides oAuth support in PHP 5.3+ and is very easy to integrate with any project which requires an oAuth client.


Supported services

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

Included service implementations:

  • OAuth1

    • Twitter
    • FitBit
  • OAuth2

    • Google
    • Microsoft
    • Facebook
    • GitHub
    • BitLy
    • Yammer
    • SoundCloud
    • Foursquare
    • Instagram
    • LinkedIn
    • Box
    • Tumblr
    • Vkontakte

To learn more about Lusitanian/PHPoAuthLib go here

Installation

Add oauth-4-laravel to your composer.json file:

"require": {
  "artdarek/oauth-4-laravel": "dev-master"
}

Use composer to install this package.

$ composer update

Create configuration file using artisan

$ php artisan config:publish artdarek/oauth-4-laravel

Configuration

Registering the Package

Add an alias to the bottom of app/config/app.php

'OAuth' => 'Artdarek\OAuth\facade\OAuth',

and register this service provider at the bottom of the $providers array:

'Artdarek\OAuth\OAuthServiceProvider',

Credentials

Add your credentials to app/config/packages/artdarek/oauth-4-laravel/config.php

return array( 
	
	/*
	|--------------------------------------------------------------------------
	| oAuth Config
	|--------------------------------------------------------------------------
	*/

	/**
	 * Storage
	 */
	'storage' => 'Session', 

	/**
	 * Consumers
	 */
	'consumers' => array(

		/**
		 * Facebook
		 */
	        'Facebook' => array(
	            'client_id'     => '',
	            'client_secret' => '',
	            'scope'         => [],
	        ),		

	)

);

The Storage attribute is optional and defaults to Session. Other options.

Usage

Basic usage

Just follow the steps below and you will be able to get a service class object with this one rule:

$fb = OAuth::consumer('Facebook');

Optionally, add a second parameter with the URL which the service needs to redirect to:

$fb = OAuth::consumer('Facebook','http://url.to.redirect.to');

More usage examples

For examples go here

About

OAuth Service Provider for Laravel 4

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%