stevenmaguire/oauth2-yelp

The PHP League OAuth2-Client 的 Yelp OAuth 2.0 客户端提供者

0.1.0 2017-05-17 02:55 UTC

This package is auto-updated.

Last update: 2024-09-14 11:25:30 UTC


README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

此包为 PHP League 的 OAuth 2.0 客户端提供 Yelp OAuth 2.0 支持。OAuth 2.0 Client

安装

要安装,请使用 composer

composer require stevenmaguire/oauth2-yelp

用法

用法与 The League 的 OAuth 客户端相同,使用 \Stevenmaguire\OAuth2\Client\Provider\Yelp 作为提供者。

客户端凭证流

$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());

}

有关此包的进一步用法,请参阅核心包文档中的“客户端凭证授予”部分

由于 Yelp Fusion OAuth2 实现的限制,此包目前仅支持客户端凭证授予,因此,如果您使用其他授权类型与包交互,将抛出 Stevenmaguire\OAuth2\Client\Provider\Exception\ProviderConfigurationException 异常。

测试

$ ./vendor/bin/phpunit

贡献

有关详细信息,请参阅贡献指南

鸣谢

许可证

MIT 许可证 (MIT)。有关更多信息,请参阅许可证文件