raymondwilkinson/manager
| Install | |
|---|---|
composer require raymondwilkinson/manager |
|
| Latest Version: | v3.0.0 |
| PHP: | ^5.6 || ^7.0 |
| Laravel: | 5 |
| License: | MIT |
| Last Updated: | Jun 22, 2017 |
| Links: | GitHub · Packagist |
Socialite Providers Manager
About
A package for Laravel Socialite that allows you to easily add new providers or override current providers.
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
- Lumen usage is easy
stateless()can be set totrueorfalse- You can override a config dynamically
- It retrieves environment variables directly from the
.envfile instead of also having to configure the services array.
Available Providers
- See the SocialiteProviders list
- You can also make your own or modify someone else's
Reference
- Laravel docs about events
- Laracasts video on events in Laravel 5
- Laravel Socialite Docs
- Laracasts Socialite video
Creating a Handler
Below is an example handler. You need to add this full class name to the listen[] in the EventServiceProvider.
- See also the Laravel docs about events.
providernameis the name of the provider such asmeetup.- You will need to change your the namespacing and class names of course.
namespace Your\Name\Space;
use SocialiteProviders\Manager\SocialiteWasCalled;
class ProviderNameExtendSocialite
{
public function handle(SocialiteWasCalled $socialiteWasCalled)
{
$socialiteWasCalled->extendSocialite('providername', \Your\Name\Space\Provider::class);
}
}
Creating a Provider
- Look at the already created providers for inspiration.
- See this article on Medium
Overriding a Built-in Provider
You can easily override a built-in laravel/socialite provider by creating a new one with exactly the same name (i.e. 'facebook').
Dynamically Passing a Config
You can dynamically pass a config by using:
$clientId = "secret";
$clientSecret = "secret";
$redirectUrl = "http://yourdomain.com/api/redirect";
$additionalProviderConfig = ['site' => 'meta.stackoverflow.com'];
$config = new \SocialiteProviders\Manager\Config($clientId, $clientSecret, $redirectUrl, $additionalProviderConfig);
return Socialite::with('provider-name')->setConfig($config)->redirect();
You must call this before you run any Socialite methods.
Creating an OAuth1 Server Class
Take a look at the other OAuth1 providers for inspiration.
Getting the Access Token Response Body
Laravel Socialite by default only allows access to the access_token. Which can be accessed
via the \Laravel\Socialite\User->token public property. Sometimes you need access to the whole response body which
may contain items such as a refresh_token.
To make this possible, the OAuth2 provider class needs to extend \SocialiteProviders\Manager\OAuth2\AbstractProvider and
OAuth1 providers need to utilize the \SocialiteProviders\Manager\OAuth1\AbstractProvider and \SocialiteProviders\Manager\OAuth1\Server.
You can access it from the user object like so: $user->accessTokenResponseBody
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v3.0.0 | ^5.6 || | MIT | ||
| v2.2.2 | ^5.6 || | MIT | ||
| v2.2.1 | ^5.6 || | MIT | ||
| v2.2.0 | ^5.6 || | MIT | ||
| v2.1.4 | ^5.6 || | MIT | ||
| v2.1.3 | ^5.6 || | MIT | ||
| v2.1.2 | ^5.6 || | MIT | ||
| v2.1.1 | ^5.6 || | MIT | ||
| v2.1.0 | ^5.6 || | MIT | ||
| v2.0.2 | ^5.6 || | MIT | ||
| v2.0.1 | ^5.6 || | MIT | ||
| v2.0.0 | ^5.6 || | MIT | ||
| 1.2.4 | >=5.5.0 | ~5.0| | MIT | |
| 1.2.3 | >=5.5.0 | ~5.0| | MIT | |
| 1.2.2 | >=5.5.0 | ~5.0| | MIT | |
| 1.2.1 | >=5.5.0 | ~5.0| | MIT | |
| 1.2.0 | >=5.5.0 | ~5.0| | MIT | |
| 1.1.1 | >=5.5.0 | ~5.0| | MIT | |
| 1.1.0 | >=5.5.0 | ~5.0| | MIT | |
| 1.0.2 | >=5.5.0 | ~5.0| | MIT | |
| 1.0.1 | >=5.5.0 | ~5.0| | MIT | |
| 1.0.0 | >=5.5.0 | ~5.0 | MIT | |
| 0.1.10 | >=5.4.0 | ~5.0 | MIT | |
| 0.1.9 | >=5.4.0 | 5.0.* | MIT | |
| 0.1.8 | >=5.4.0 | 5.0.* | MIT | |
| 0.1.7 | >=5.4.0 | 5.0.* | MIT | |
| 0.1.6 | >=5.4.0 | 5.0.* | MIT | |
| 0.1.5 | >=5.4.0 | 5.0.* | MIT | |
| 0.1.4 | >=5.4.0 | ~5.0 | MIT | |
| 0.1.3 | >=5.4.0 | ~5.0 | MIT |
Showing the latest 30 of 33. See every release on Packagist



