rockbuzz / lara-client
identifying client applications
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-10-30 02:37:00 UTC
README
Identifying client applications
Requirements
PHP: >=7.1
Install
$ composer require rockbuzz/lara-client
Configuration
$ php artisan vendor:publish --provider="Rockbuzz\LaraClient\ServiceProvider"
$ php artisan migrate
Usage
In App\Http\Kernel.php
protected $middlewareGroups = [ 'api' => [ 'throttle:60,1', 'bindings', \Rockbuzz\LaraClient\Identifier::class ], ];
Add client
$ php artisan client:create clientName
Access Example
$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), ] ]);
License
The Lara Client is open-sourced software licensed under the MIT license.