skulich / laravel-user-token-management-cli
A Laravel package that allows managing Users and their Tokens from CLI
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/skulich/laravel-user-token-management-cli
Requires
- php: ^8.3
- laravel/framework: ^12.42.0
- laravel/prompts: ^0.3.8
Requires (Dev)
- larastan/larastan: ^3.8
- laravel/pint: ^1.26
- laravel/sanctum: ^4.2
- orchestra/testbench: ^10.8
- pestphp/pest: ^4.1
- pestphp/pest-plugin-laravel: ^4.0
- pestphp/pest-plugin-type-coverage: ^4.0
- phpstan/extension-installer: ^1.4
- rector/rector: ^2.2
- symfony/var-dumper: ^7.4
README
A Laravel package that lets you create and delete users and tokens from the CLI.
This can be useful for API microservices where only one user is needed to access the API.
Note: User token commands are available only when
Sanctumis installed and theUsermodel is tokenable.
Note: This package provides only basic token support. It does not support abilities, expiration, etc.
Table of contents
Installation
Install the package via Composer.
composer require skulich/laravel-user-token-management-cli
Usage
The package provides five Artisan commands to manage users and their tokens.
User Commands
Run these Artisan commands to manage users.
# create a new user php artisan user:create # delete a user php artisan user:delete # list users php artisan user:list
User Token Commands
Run these Artisan commands to manage user tokens.
# create a new token for the user php artisan user:token:create # delete tokens for the user php artisan user:token:delete # list user tokens php artisan user:token:list
User Model Binding
If your User model class is not located in the App\Models\User namespace,
you must bind App\Models\User to your implementation in the boot() method of AppServiceProvider.
namespace App\Providers; class AppServiceProvider extends ServiceProvider { public function boot(): void { app()->bind('\App\Models\User', fn () => resolve('\App\User'), true); } }
Tests
Run the entire test suite:
composer test
Changelog
Please see CHANGELOG for more information.
Contributing
Please see CONTRIBUTING for more information.
License
The MIT License (MIT). Please see LICENSE for more information.