glocurrency / api-layer
This package is abandoned and no longer maintained.
No replacement package was suggested.
Basic API package.
v0.1-alpha
2020-07-14 05:03 UTC
Requires
- php: ^7.2
- goldspecdigital/laravel-eloquent-uuid: ^7.0
- laravel/passport: ^9.2
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: ^4.4|^5.0
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2020-09-14 06:11:33 UTC
README
Installation
composer require glocurrency/api-layer
Passport
This module use Laravel Passport heavily. In order to make it work properly, follow the steps:
- Run
php artisan glo:apilayer:passport
This command will:
- generate the keys
- copy the migrations from passport
- replace both
client_id
anduser_id
columns in migrations with UUID.
- Copy the passport middlewares to the
$routeMiddleware
in yourapp/Http/Kernel.php
file:
'client' => \Laravel\Passport\Http\Middleware\CheckClientCredentials::class, 'scopes' => \Laravel\Passport\Http\Middleware\CheckScopes::class, 'scope' => \Laravel\Passport\Http\Middleware\CheckForAnyScope::class,
- Add the following code to the
boot
method ofAuthServiceProvider
:
use Glocurrency\ApiLayer\ApiLayer; public function boot() { $this->registerPolicies(); ApiLayer::passport(); }
php artisan passport:client --client
php artisan passport:client --personal
After creating your personal access client, place the client's ID and plain-text secret value in your application's .env
file:
PASSPORT_PERSONAL_ACCESS_CLIENT_ID=client-id-value PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET=unhashed-client-secret-value
- Use
UnauthenticatedTrait
in yourapp/Exceptions/Handler.php
file:
use Glocurrency\ApiLayer\Traits\UnauthenticatedTrait; class Handler extends ExceptionHandler { use UnauthenticatedTrait;
License
Glocurrency Api Layer is open-sourced software licensed under the MIT license.