Download the PHP package nomadnt/lumen-passport without Composer
On this page you can find all versions of the php package nomadnt/lumen-passport. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nomadnt/lumen-passport
More information about nomadnt/lumen-passport
Files in nomadnt/lumen-passport
Package lumen-passport
Short Description Lumen porting of Laravel Passport
License MIT
Homepage https://github.com/nomadnt/lumen-passport
Informations about the package lumen-passport
Lumen Passport
Lumen porting of Laravel Passport. The idea come from https://github.com/dusterio/lumen-passport but try to make it transparent with original laravel passport
Dependencies
- PHP >= 8.0
- Lumen >= 11.0
- Laravel Passport >= 12.0
Installation
First of all let's install Lumen Framework if you haven't already.
Then install Lumen Passport (it will fetch Laravel Passport along):
Configuration
Generate your APP_KEY and update .env with single command
Configure your database connection (ie to use SQLite) This is how your .env file should looking after the changes
Copy the Lumen configuration folder to your project
Update guards
and provider
section of your config/auth.php to match Passport requirements
You need to change a little the bootstrap/app.php
file doing the following:
Create database.sqlite
Lauch the migrations
Install Laravel passport
The previous command should give back to you an output similar to this:
User model
Make sure your user model uses Passport's HasApiTokens
trait, eg.:
Access Token Events
Prune and/or Revoke tokens
If you want to revoke or purge tokens on event based you have to create related Listeners and
register on your app/Http/Providers/EventServiceProvider.php
istead of using deprecated properties
Passport::$revokeOtherTokens = true;
and Passport::$pruneRevokedTokens = true;
First you need to make sure that EventServiceProvider
is registered on your bootstrap/app.php
Then you need to listen for AccessTokenCreated
event and register your required listeners
Create the app/Listeners/RevokeOtherTokens.php
file and put the following content
Create the app/Listeners/PruneRevokedTokens.php
file and put the following content