rockbuzz/lara-client

identifying client applications

1.0.4 2020-09-25 10:56 UTC

This package is auto-updated.

Last update: 2024-03-30 00:30:33 UTC


README

Identifying client applications

Build Status

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.