laravel-artisan maintained by machus
Laravel Artisan Commands
A Laravel package providing reusable artisan commands for common development tasks across multiple projects.
Installation
You can install the package via composer:
composer require machus/laravel-artisan:@dev
composer dump-autoload
php artisan clear-compiled
php artisan optimize:clear
The service provider will be automatically registered via Laravel's package discovery.
Available Commands
clear:all
Runs all Laravel clear commands in one go:
php artisan clear:all
This command will clear:
- Application cache (
cache:clear) - Configuration cache (
config:clear) - Route cache (
route:clear) - Compiled views (
view:clear) - Compiled class file (
clear-compiled)
reset
Completely resets your application by clearing all caches and running fresh migrations with seeding:
php artisan reset
This command will:
- Run
clear:allto clear all caches - Run
migrate:fresh --seed --forceto reset the database
Warning: This command will drop all tables and re-run migrations. Use with caution in production environments.
User Management Commands
user:create
Create a new user interactively or with options:
# Interactive mode
php artisan user:create
# With options
php artisan user:create --name="John Doe" --email="john@example.com" --password="secret123"
user:list
List all users with optional search and limit:
# List users (default: 50)
php artisan user:list
# Search by name or email
php artisan user:list --search="john"
# Limit results
php artisan user:list --limit=10
user:delete
Delete a user by ID or email:
# Delete by ID
php artisan user:delete 1
# Delete by email
php artisan user:delete john@example.com
# Skip confirmation
php artisan user:delete 1 --force
Note: All user commands require Laravel's authentication framework to be installed. They will show an error if the User model is not found.
Usage
After installation, the commands are immediately available in your Laravel application:
# Clear all caches
php artisan clear:all
# Reset application (clear caches + fresh migrations with seeding)
php artisan reset
# User management
php artisan user:create
php artisan user:list
php artisan user:delete 1
Requirements
- PHP 8.1 or higher
- Laravel 10.x or 11.x
Credits
Built using spatie/laravel-package-tools
License
The MIT License (MIT).