Could we help you? Please click the banners. We are young and desperately need the money
Artisan is Laravel’s powerful command-line interface (CLI) that helps developers speed up development tasks like migrations, controllers, models, and caching. Whether you’re new to Laravel or a growing junior developer, this cheat sheet will walk you through the most essential Artisan commands you should know in 2025.
Artisan is Laravel’s built-in command-line tool. You can run it with:
php artisan
It provides dozens of commands for generating code, running migrations, managing routes, and much more. You can even create your own custom Artisan commands!
php artisan list
Displays a list of all available Artisan commands.
php artisan help migrate
Shows help and usage information for a specific command.
php artisan migrate
Runs all pending migrations.
php artisan migrate:rollback
Rolls back the last batch of migrations.
php artisan migrate:fresh
Drops all tables and re-runs all migrations from scratch. This means that all data will be lost.
php artisan db:seed
Runs the database seeders (for populating test data).
php artisan migrate --seed
Runs migrations and seeds in a single step.
php artisan make:model Post
Creates a new Eloquent model called "Post".
php artisan make:controller PostController
Generates a new controller class.
php artisan make:controller PostController --resource
Creates a resource controller with CRUD methods pre-defined.
php artisan make:migration create_posts_table
Generates a new migration file.
php artisan make:seeder UserSeeder
Creates a new seeder class for test data.
php artisan route:list
Lists all registered routes, their names, methods, and controllers.
php artisan route:cache
Caches all routes for better performance (avoid using closures in cached routes).
php artisan route:clear
Clears the cached routes.
php artisan cache:clear
Clears the application cache.
php artisan config:cache
Combines configuration files into a single cached file for faster loading.
php artisan config:clear
Clears the configuration cache.
php artisan optimize
Optimizes the app by caching routes, config, and views (useful before deployment).
php artisan queue:work
Processes queued jobs in real-time.
php artisan queue:listen
Listens for new jobs and processes them as they arrive (development use).
php artisan schedule:run
Executes the scheduled tasks defined in "app/Console/Kernel.php".
php artisan tinker
Launches an interactive REPL to experiment with your Laravel app. If you are developing inside of a docker environment, you might not be able to access the database through tinker.
php artisan dump-server
Starts the dump server to monitor "dump()" output in real time.
php artisan down
Puts the application into maintenance mode.
php artisan up
Brings the application back online.
You can create your own custom Artisan commands:
php artisan make:command SendDailyReport
This creates a file in "app/Console/Commands". You can define the command’s logic and signature inside the generated class.
protected $signature = 'report:daily';
protected $description = 'Send the daily report email';
Now, run it with:
php artisan report:dailyphp artisan key:generate – Generate a new application key.php artisan storage:link – Create a symbolic link for public file storage.php artisan make:middleware CheckRole – Create a middleware class.php artisan make:request StoreUserRequest – Create a form request class for validation.php artisan vendor:publish – Publish package assets or config files.php artisan list regularly to discover new commands.php artisan help <command> to understand command options.php artisan tinker to quickly test Eloquent queries or logic (might not work in docker environments).php artisan optimize for speed.Laravel’s Artisan CLI is a productivity powerhouse that every developer should master. From generating models to managing migrations and caching routes, Artisan helps you build faster, cleaner, and more reliable applications. Keep this cheat sheet handy to speed up your workflow and become a more efficient Laravel developer.