# Contribute
# Creating a Provider
- 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.
- Generate documentation for the provider by running
docgen.php
in thetools
folder. (and customise if required). - Add the provider to the
monorepo-builder.yml
subtree split config in the repository root.
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
.
- See also the Laravel docs about events
providername
is the name of the provider such asmeetup
.- 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
- See this article on Medium about creating a new provider
- Laravel docs on events
# 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.