Menü schliessen
Created: October 17th 2025
Last updated: October 9th 2025
Categories: IT Development,  Laravel
Author: Ian Walser

Laravel Artisan Commands Cheat Sheet (2025)

Introduction

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.

What Is Artisan?

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!


Basic Application 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.


Database & Migrations

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.


Model, Controller & Resource Generation

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.


Working with Routes

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.


Cache, Config & Optimization

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).


Queue, Jobs & Schedule

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".


Debugging & Development

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.


Creating Custom Artisan Commands

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:daily

Useful One-Liners

  • php 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.

Final Tips for Using Artisan Effectively

  • Use php artisan list regularly to discover new commands.
  • Use php artisan help <command> to understand command options.
  • Use php artisan tinker to quickly test Eloquent queries or logic (might not work in docker environments).
  • Before deploying, always run php artisan optimize for speed.
  • Create custom Artisan commands to automate repetitive developer tasks.

Conclusion

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.