About

SocialiteProviders is a collection of OAuth 1 & 2 packages that extend Laravel Socialite.

The Observer Pattern is used by the Manager package to extend Socialite. This allows numerous providers to be used in addition to the ones provided by Laravel Socialite (they can be overridden easily). Only the providers that you add to the listeners array will be used.

Nearly all of the providers were created by @faustbrian while the Manager for the providers was created by @AndyWendt.

Benefits

  • You will have access to all of the providers that you load in using the Manager.
  • Instantiation is deferred until Socialite is called
  • You can override current providers
  • You can create new providers

Contribute

Creating a Provider

To create a provider package

  • Create the provider class
  • Create a listener/handler
  • Create a composer.json file and add socialiteproviders/manager (See the manager package.) in the "require" section.
  • If using OAuth1 you need to also create a server class.

To speed up the creation of your provider you can use the generator.

Look at the already created providers and the Manager package for inspiration.

Submitting a new provider

Send new provider pull requests to the Providers repo.

Creating a handler

Below is an example handler. You need to add the fully qualified class name to the `listen[]` in the `EventServiceProvider`.

  1. See also the Laravel docs about events
  2. `providername` is the name of the provider such as `meetup`.
  3. You will need to change the namespaces to match your vendor and package name.

namespace Your\Name\Space;

use SocialiteProviders\Manager\SocialiteWasCalled;

class ProviderNameExtendSocialite
{
    public function handle(SocialiteWasCalled $socialiteWasCalled)
    {
        $socialiteWasCalled->extendSocialite('providername', 'Your\Name\Space\ProviderName');
    }
}

        

Resources

Overriding a Built-in Provider

You can easily override a built-in laravel/socialite provider by creating a new provider with exactly the same name (i.e. 'facebook').

Tests

If we have tests in the repo (currently and foreseeably only the (Manager package) you need to have tests cover any changes submitted in a pull request. We currently use PHPUnit and Mockery for our test suite.

Style

Run PHP-CS-Fixer on your machine and put a .styleci.yml into the repository with preset: symfony to make sure that pull requests and merges follow the Symfony Coding Standards.