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

1.1.0 2025-12-22 16:47 UTC

This package is auto-updated.

Last update: 2025-12-26 14:52:49 UTC


README

Latest Version on Packagist PHP Version Require Laravel Version Run Tests Code Coverage License Total Downloads

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 Sanctum is installed and the User model 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.