payloadtoken / aragorn52
this library for payload from access token in lumen passport
1.0.4
2022-09-20 08:14 UTC
Requires
- php: ^8.1
- laravel/lumen-framework: ^9.0
- samfrm/lumen-passport: ^0.1.1
Requires (Dev)
- squizlabs/php_codesniffer: 3.5.1
This package is auto-updated.
Last update: 2025-01-20 13:32:04 UTC
README
Library to add payload to Access token for lumen passport
Dependencies
- PHP >= 8.1
- Lumen >= 9.0
- Lumen-passport: >= 0.1.1
Installation via Composer
$ composer require payloadtoken/aragorn52
Or if you prefer, edit composer.json
manually:
{ "require": { "payloadtoken/aragorn52": "^1.0" } }
Modify the bootstrap flow (bootstrap/app.php
file)
$app->register(\Payload\Providers\PassportServiceProvider::class);
Create YourCustomClaimService. Extends \Payload\Services\AbstractClaimService
in method addCustomClaim add for claimCollection your claims
id user can be obtained by accessing the $this->id property YourCustomClaimService
class YourCustomClaimService extends \Payload\Services\AbstractClaimService { public function addCustomClaims(): void { $this->claimCollection->add('test', 'testClaim'); $this->claimCollection->add('test2', 'testClaim2'); } }
Modify the AppServiceProvider flow (app/Providers/PassportServiceProvider
) add this code in method boot()
public function boot() { $this->app->bind(\Payload\Services\AbstractClaimService::class, fn () => new YourCustomClaimService()); }