stevenmaguire / oauth2-yelp
Yelp OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Installs: 15 377
Dependents: 0
Suggesters: 2
Security: 0
Stars: 2
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- league/oauth2-client: ^2.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: ~2.0
This package is auto-updated.
Last update: 2024-12-14 12:00:05 UTC
README
This package provides Yelp OAuth 2.0 support for the PHP League's OAuth 2.0 Client.
Installation
To install, use composer:
composer require stevenmaguire/oauth2-yelp
Usage
Usage is the same as The League's OAuth client, using \Stevenmaguire\OAuth2\Client\Provider\Yelp
as the provider.
Client Credentials Flow
$provider = new Stevenmaguire\OAuth2\Client\Provider\Yelp([ 'clientId' => '{yelp-client-id}', 'clientSecret' => '{yelp-client-secret}' ]); try { // Try to get an access token using the client credentials grant. $accessToken = $provider->getAccessToken('client_credentials'); } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) { // Failed to get the access token exit($e->getMessage()); }
For further usage of this package please refer to the core package documentation on "Client Credentials Grant".
Due to the constraints of Yelp Fusion's OAuth2 implementation, this package currently only supports the Client Credentials Grant and as a result, if you engage with the package for other grant types a Stevenmaguire\OAuth2\Client\Provider\Exception\ProviderConfigurationException
exception will be thrown.
Testing
$ ./vendor/bin/phpunit
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.