rockbuzz / lara-client
识别客户端应用
1.0.4
2020-09-25 10:56 UTC
Requires
- php: >=7.1
Requires (Dev)
- orchestra/testbench: ^3.7
- phpunit/phpunit: ^7.0
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2024-08-30 02:05:35 UTC
README
识别客户端应用
要求
PHP: >=7.1
安装
$ composer require rockbuzz/lara-client
配置
$ php artisan vendor:publish --provider="Rockbuzz\LaraClient\ServiceProvider"
$ php artisan migrate
使用
在 App\Http\Kernel.php
protected $middlewareGroups = [ 'api' => [ 'throttle:60,1', 'bindings', \Rockbuzz\LaraClient\Identifier::class ], ];
添加客户端
$ php artisan client:create clientName
访问示例
$httpClient = new Guzzle\Http\Client(); $httpClient->request('GET', 'https://endpoint.com/api/resource', [ 'headers' => [ 'X-API-KEY' => $client->publicKey, 'X-API-TOKEN' => hash_hmac('sha256', $client->publicKey, $client->secretKey), ] ]);
许可证
Lara 客户端是开源软件,根据 MIT 许可证 发布。