Skip to content

Instantly share code, notes, and snippets.

@ppcdias
Last active January 16, 2026 00:16
Show Gist options
  • Select an option

  • Save ppcdias/9a6a6cddb7fd164f45f5ab6e33270bda to your computer and use it in GitHub Desktop.

Select an option

Save ppcdias/9a6a6cddb7fd164f45f5ab6e33270bda to your computer and use it in GitHub Desktop.
PHP Laravel Artisan Useful CLI/SSH Commands List
# Laravel Artisan Cheatsheet (Laravel 11/12)
# 1. Basic Information
php artisan --version # Display the current Laravel version
php artisan about # Show detailed application and environment info
php artisan list # List all available Artisan commands
php artisan help <command> # Show detailed help for a specific command
php artisan inspire # Display an inspiring quote
# 2. Development Server
php artisan serve # Start the Laravel development server[](http://127.0.0.1:8000)
php artisan serve --port=8080 # Start server on a custom port
php artisan serve --host=0.0.0.0 # Make server accessible on local network
# 3. Generators (make:*)
php artisan make:model Customer # Create a new Eloquent model
php artisan make:model Post -m # Create model + migration
php artisan make:model Post -mfcr # Model + migration + factory + resourceful controller
php artisan make:controller PostController # Create a new controller
php artisan make:controller Api/V1/PostController --api # Create an API resource controller
php artisan make:migration create_posts_table # Create a new migration file
php artisan make:migration add_slug_to_posts --table=posts # Migration to add column(s) to existing table
php artisan make:seeder PostSeeder # Create a new seeder class
php artisan make:factory PostFactory # Create a new model factory
php artisan make:request StorePostRequest # Create a form request validation class
php artisan make:policy PostPolicy --model=Post # Create a policy class for a model
php artisan make:command SendDailyReport # Create a custom Artisan command
php artisan make:job ProcessPodcast # Create a new job class
php artisan make:mail WelcomeEmail --markdown=emails.welcome # Create a mailable class with markdown template
# 4. Database - Migrations & Seeders
php artisan migrate # Run all outstanding migrations
php artisan migrate --force # Run migrations without confirmation (production)
php artisan migrate:fresh # Drop all tables and re-run all migrations
php artisan migrate:fresh --seed # Fresh migrate + run all seeders
php artisan migrate:rollback # Rollback the last migration batch
php artisan migrate:rollback --step=5 # Rollback the last N migration batches
php artisan migrate:status # Show the status of each migration
php artisan db:seed # Run all Database Seeders
php artisan db:seed --class=UserSeeder # Run a specific seeder class
# 5. Routes
php artisan route:list # Display all registered routes
php artisan route:list --path=api # Filter routes by path/URI
php artisan route:list --compact # Compact route listing (cleaner output)
php artisan route:cache # Cache the routes for faster registration
php artisan route:clear # Clear the route cache
# 6. Cache & Optimization
php artisan optimize:clear # Clear all cached files (config, routes, views, etc.)
php artisan cache:clear # Clear the application cache
php artisan config:cache # Create a cached configuration file
php artisan config:clear # Remove the configuration cache file
php artisan view:cache # Compile all Blade views
php artisan view:clear # Clear all compiled view files
php artisan route:cache # Cache the routes file
# 7. Testing & Tinker
php artisan test # Run the application's test suite
php artisan test --filter testExample # Run tests matching a filter/pattern
php artisan tinker # Interact with your application using REPL
# 8. Queue
php artisan queue:work # Start processing jobs from the queue
php artisan queue:work --queue=high,default --tries=3 # Work specific queues with retry limit
php artisan queue:restart # Restart queue workers after current job
php artisan queue:failed # List all failed queue jobs
php artisan queue:retry all # Retry all failed jobs
php artisan queue:flush # Flush all failed jobs from the failed queue
# 9. Other Essential Commands
php artisan key:generate # Set the application key (APP_KEY)
php artisan storage:link # Create symbolic link from public/storage to storage/app/public
php artisan down # Put the application into maintenance mode
php artisan up # Bring the application out of maintenance mode
php artisan env # Display the current environment
php artisan schedule:run # Run the scheduled commands (for testing)
php artisan schedule:work # Start the schedule worker (runs every minute)
# Quick filters (useful in terminal)
# php artisan list | grep make # See all make:* commands
# php artisan list | grep queue # See all queue-related commands
# php artisan list | grep cache # See all cache-related commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment