承接 sarahman/oauth-tokens-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sarahman/oauth-tokens-client

最新稳定版本:1.1.1

Composer 安装命令:

composer require sarahman/oauth-tokens-client

包简介

This package handles the oauth tokens with caching functionality.

README 文档

README

Latest Version on Packagist Build Status Scrutinizer Code Quality StyleCI Total Downloads License PHP Version Require

PHP library built by PSR-16 simple cache interface can be used in any php project or it has laravel support to install through its service provider.

Installation

  • Step 1: You can install the package via composer:
composer require sarahman/oauth-tokens-client
  • Step 2.a: Next, for the laravel projects, we can load its service provider:
// app/config/app.php 'providers' => [ ... 'Sarahman\OauthTokensClient\OauthTokensClientServiceProvider', ];

You can publish the config file with:

php artisan config:publish sarahman/oauth-tokens-client

This is the contents of the published config file:

return array( 'TOKEN_PREFIXES' => array( 'ACCESS' => 'oauth_access_token', 'REFRESH' => 'oauth_refresh_token', ), 'LOCK_KEY' => 'oauth_token_refresh_lock', 'OAUTH_CREDENTIAL' => array( 'GRANT_TYPE' => 'client_credentials', 'TOKEN_URL' => null, 'REFRESH_URL' => null, 'CLIENT_ID' => null, 'CLIENT_SECRET' => null, 'USERNAME' => null, 'PASSWORD' => null, 'SCOPE' => '', ), );

Note: If we use password grant, then we must set USERNAME and PASSWORD config keys.

  • Step 2.b: for the regular php projects, we might directly add these following codes:
require "vendor/autoload.php"; $clientConfig = array( 'TOKEN_PREFIXES' => array( 'ACCESS' => 'oauth_access_token', 'REFRESH' => 'oauth_refresh_token', ), 'LOCK_KEY' => 'oauth_token_refresh_lock', 'OAUTH_CREDENTIAL' => array( 'GRANT_TYPE' => 'client_credentials', 'TOKEN_URL' => 'http://localhost/grant-token', 'REFRESH_URL' => 'http://localhost/refresh-token', 'CLIENT_ID' => 1, 'CLIENT_SECRET' => '**********', 'SCOPE' => '', ), ); $client = new OAuthClient( new Client, <CACHE_STORE>, $clientConfig['OAUTH_CREDENTIAL'], $clientConfig['TOKEN_PREFIXES'], $clientConfig['LOCK_KEY'] ); // Set Cache key. $data = array( 'sample' => 'data', 'another' => 'data', ); $response = $client->request('POST', 'http://localhost/get-user', $data); var_dump($response);

Testing

You might go to the project directory and run the following command to run test code.

composer test

Contribution

Feel free to contribute in this library. Please make your changes and send us pull requests.

Security Issues

If you discover any security related issues, please feel free to create an issue in the issue tracker or write us at aabid048@gmail.com.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 1.32k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固