Laravel Artisan Cheat Sheet Laravel 10.x+
A searchable reference of the most common php artisan commands with syntax, examples, and sample output.
- Home
- > Web Dev > Laravel Tools >
- Artisan Cheat Sheet
Browse Artisan Commands
Type to filter by command name or description. Press Esc to clear.
php artisan list
List all available Artisan commands
Usage: php artisan list [--format=text|json|xml] [--raw] [--no-ansi]
Example: php artisan list
Output: Available commands:\n help ............ Display help for a command\n list ............ List commands\n migrate ......... Run the database migrations
php artisan help
<command>
Display the help screen for a given command
Usage: php artisan help <command>
Example: php artisan help migrate
Output: Description:\n Run the database migrations\n\nUsage:\n migrate [options]
php artisan about
Display basic information about your application
Usage: php artisan about [--only=env] [--json]
Example: php artisan about
Output: Environment ......... local\nDebug Mode .......... true\nApplication URL ..... http://localhost\nLaravel Version ..... 11.0.0
php artisan env
Display the current framework environment
Usage: php artisan env
Example: php artisan env
Output: The application environment is "local".
php artisan down
Put the application into maintenance mode
Usage: php artisan down [--refresh=N] [--retry=N] [--secret=token] [--status=503]
Example: php artisan down --retry=60
Output: Application is now in maintenance mode.
php artisan up
Bring the application out of maintenance mode
Usage: php artisan up
Example: php artisan up
Output: Application is now live.
php artisan serve
Serve the application on the PHP development server
Usage: php artisan serve [--host=0.0.0.0] [--port=8000] [--tries=N]
Example: php artisan serve --port=8080
Output: Starting Laravel development server: http://127.0.0.1:8080\n[Sun Jan 01 00:00:00 2025] PHP 8.2.x Development Server started
php artisan key:generate
Set the application key (APP_KEY in .env)
Usage: php artisan key:generate [--show] [--force] [--env=...]
Example: php artisan key:generate
Output: Application key set successfully.
php artisan tinker
Interact with your application in a REPL
Usage: php artisan tinker [--execute="..."] [--no-interaction]
Example: php artisan tinker
Output: Psy Shell v0.11.x (PHP 8.2.x — cli) by Justin Hileman\n>>>
php artisan optimize
Cache framework bootstrap, configuration, and metadata
Usage: php artisan optimize [--except=foo,bar]
Example: php artisan optimize
Output: Configuration cached successfully.\nRoutes cached successfully.\nFiles cached successfully.
php artisan optimize:clear
Remove all cached bootstrap files
Usage: php artisan optimize:clear
Example: php artisan optimize:clear
Output: Caches cleared successfully.
php artisan storage:link
Create a symbolic link from public/storage to storage/app/public
Usage: php artisan storage:link [--relative] [--force]
Example: php artisan storage:link
Output: The [public/storage] directory has been linked.
php artisan make:model
<name>
Create a new Eloquent model class
Usage: php artisan make:model <name> [-a|--all] [-c|--controller] [-f|--factory] [-m|--migration] [-s|--seed] [-p|--policy] [-r|--resource]
Example: php artisan make:model Post -m -c -f
Output: INFO Model [app/Models/Post.php] created successfully.
php artisan make:controller
<name>
Create a new HTTP controller class
Usage: php artisan make:controller <name> [-r|--resource] [-i|--invokable] [-m|--model=...] [-p|--parent=...] [-s|--stubs=...]
Example: php artisan make:controller PostController --resource
Output: INFO Controller [app/Http/Controllers/PostController.php] created successfully.
php artisan make:migration
<name>
Create a new database migration file
Usage: php artisan make:migration <name> [--create=table] [--table=table] [--path=...] [--realpath]
Example: php artisan make:migration create_posts_table
Output: INFO Migration [database/migrations/2025_01_01_000001_create_posts_table.php] created successfully.
php artisan make:seeder
<name>
Create a new database seeder class
Usage: php artisan make:seeder <name>
Example: php artisan make:seeder PostSeeder
Output: INFO Seeder [database/seeders/PostSeeder.php] created successfully.
php artisan make:factory
<name>
Create a new model factory
Usage: php artisan make:factory <name> [--model=...]
Example: php artisan make:factory PostFactory --model=Post
Output: INFO Factory [database/factories/PostFactory.php] created successfully.
php artisan make:mail
<name>
Create a new email class
Usage: php artisan make:mail <name> [-m|--markdown] [--view=...] [--test]
Example: php artisan make:mail OrderShipped --markdown=emails.shipped
Output: INFO Mailable [app/Mail/OrderShipped.php] created successfully.
php artisan make:notification
<name>
Create a new notification class
Usage: php artisan make:notification <name> [-m|--markdown] [--view=...]
Example: php artisan make:notification InvoicePaid
Output: INFO Notification [app/Notifications/InvoicePaid.php] created successfully.
php artisan make:event
<name>
Create a new event class
Usage: php artisan make:event <name>
Example: php artisan make:event OrderShipped
Output: INFO Event [app/Events/OrderShipped.php] created successfully.
php artisan make:listener
<name>
Create a new event listener class
Usage: php artisan make:listener <name> [-e|--event=...] [--queued]
Example: php artisan make:listener SendShipmentNotification --event=OrderShipped
Output: INFO Listener [app/Listeners/SendShipmentNotification.php] created successfully.
php artisan make:job
<name>
Create a new queueable job class
Usage: php artisan make:job <name> [--sync] [--queued]
Example: php artisan make:job ProcessPodcast
Output: INFO Job [app/Jobs/ProcessPodcast.php] created successfully.
php artisan make:middleware
<name>
Create a new HTTP middleware class
Usage: php artisan make:middleware <name>
Example: php artisan make:middleware CheckAge
Output: INFO Middleware [app/Http/Middleware/CheckAge.php] created successfully.
php artisan make:policy
<name>
Create a new authorization policy class
Usage: php artisan make:policy <name> [-m|--model=...] [-g|--guard=...]
Example: php artisan make:policy PostPolicy --model=Post
Output: INFO Policy [app/Policies/PostPolicy.php] created successfully.
php artisan make:provider
<name>
Create a new service provider class
Usage: php artisan make:provider <name>
Example: php artisan make:provider RiakServiceProvider
Output: INFO Provider [app/Providers/RiakServiceProvider.php] created successfully.
php artisan make:request
<name>
Create a new form request class
Usage: php artisan make:request <name>
Example: php artisan make:request StorePostRequest
Output: INFO Form Request [app/Http/Requests/StorePostRequest.php] created successfully.
php artisan make:resource
<name>
Create a new API resource (Eloquent transform layer)
Usage: php artisan make:resource <name> [-c|--collection]
Example: php artisan make:resource UserResource
Output: INFO Resource [app/Http/Resources/UserResource.php] created successfully.
php artisan make:rule
<name>
Create a new custom validation rule
Usage: php artisan make:rule <name> [-i|--implicit]
Example: php artisan make:rule Uppercase
Output: INFO Rule [app/Rules/Uppercase.php] created successfully.
php artisan make:command
<name>
Create a new Artisan console command
Usage: php artisan make:command <name> [-c|--command=...] [--command-name=...]
Example: php artisan make:command SendEmails
Output: INFO Command [app/Console/Commands/SendEmails.php] created successfully.
php artisan make:cast
<name>
Create a new custom Eloquent cast class
Usage: php artisan make:cast <name> [-i|--inbound]
Example: php artisan make:cast Json
Output: INFO Cast [app/Casts/Json.php] created successfully.
php artisan make:observer
<name>
Create a new Eloquent observer class
Usage: php artisan make:observer <name> [-m|--model=...]
Example: php artisan make:observer PostObserver --model=Post
Output: INFO Observer [app/Observers/PostObserver.php] created successfully.
php artisan make:scope
<name>
Create a new Eloquent local query scope class
Usage: php artisan make:scope <name>
Example: php artisan make:scope Ancient
Output: INFO Scope [app/Models/Scopes/Ancient.php] created successfully.
php artisan make:test
<name>
Create a new PHPUnit or Pest test class
Usage: php artisan make:test <name> [--unit] [--pest] [--phpunit]
Example: php artisan make:test PostTest --unit
Output: INFO Test [tests/Unit/PostTest.php] created successfully.
php artisan make:channel
<name>
Create a new broadcasting channel class
Usage: php artisan make:channel <name> [-m|--model=...]
Example: php artisan make:channel OrderChannel --model=Order
Output: INFO Channel [app/Broadcasting/OrderChannel.php] created successfully.
php artisan migrate
Run the database migrations
Usage: php artisan migrate [--database=...] [--force] [--path=...] [--realpath] [--pretend] [--seed] [--seeder=...] [--step]
Example: php artisan migrate
Output: INFO Running migrations.\n 2014_10_12_000000_create_users_table ........... 85ms DONE\n 2014_10_12_100000_create_password_reset_tokens_table 70ms DONE
php artisan migrate:rollback
Rollback the last database migration (or a batch)
Usage: php artisan migrate:rollback [--step=N] [--batch=N] [--force] [--pretend]
Example: php artisan migrate:rollback --step=2
Output: INFO Rolling back migrations.\n 2025_01_01_000001_create_posts_table ........... 35ms DONE
php artisan migrate:reset
Rollback all database migrations
Usage: php artisan migrate:reset [--force] [--pretend]
Example: php artisan migrate:reset
Output: INFO Rolling back all migrations.\n 2014_10_12_000000_create_users_table ........... DONE\n ... DONE
php artisan migrate:refresh
Reset and re-run all migrations (keeps tables intact)
Usage: php artisan migrate:refresh [--step=N] [--seed] [--seeder=...] [--force]
Example: php artisan migrate:refresh --seed
Output: INFO Rolling back all migrations.\n ... DONE\nINFO Running migrations.\n ... DONE
php artisan migrate:fresh
Drop all tables and re-run all migrations from scratch
Usage: php artisan migrate:fresh [--drop-views] [--drop-types] [--seed] [--seeder=...] [--force]
Example: php artisan migrate:fresh --seed
Output: INFO Dropping all tables.\n ... DONE\nINFO Running migrations.\n ... DONE
php artisan migrate:status
Show the status of each migration
Usage: php artisan migrate:status [--database=...] [--pending]
Example: php artisan migrate:status
Output: +------+------------------------------------------------+-------+\n| Ran? | Migration | Batch |\n+------+------------------------------------------------+-------+\n| Yes | 2014_10_12_000000_create_users_table | 1 |
php artisan db:seed
Seed the database with records using seeders
Usage: php artisan db:seed [--class=...] [--database=...] [--force]
Example: php artisan db:seed --class=PostSeeder
Output: INFO Seeding database.\n Database seeded successfully.
php artisan db:wipe
Drop all tables, views, and types from the database
Usage: php artisan db:wipe [--database=...] [--drop-views] [--drop-types] [--force]
Example: php artisan db:wipe
Output: INFO Dropping all tables.\n ... DONE
php artisan route:list
List all registered routes
Usage: php artisan route:list [--path=...] [--method=...] [--name=...] [--reverse] [--json] [-v]
Example: php artisan route:list --path=api
Output: GET|HEAD api/user .................... users.show\nPOST api/login ................... auth.login\nGET|HEAD api/posts ................... posts.index
php artisan route:cache
Create a route cache file for faster route registration
Usage: php artisan route:cache
Example: php artisan route:cache
Output: Route cache cleared successfully.\nRoute cached successfully.
php artisan route:clear
Remove the route cache file
Usage: php artisan route:clear
Example: php artisan route:clear
Output: Route cache cleared successfully.
php artisan config:cache
Create a cache file for faster configuration loading
Usage: php artisan config:cache
Example: php artisan config:cache
Output: Configuration cached successfully.
php artisan config:clear
Remove the configuration cache file
Usage: php artisan config:clear
Example: php artisan config:clear
Output: Configuration cache cleared successfully.
php artisan cache:clear
Flush the application cache
Usage: php artisan cache:clear [--store=...] [--tags=...]
Example: php artisan cache:clear
Output: Application cache flushed successfully.
php artisan view:cache
Compile all Blade templates (pre-compile for performance)
Usage: php artisan view:cache
Example: php artisan view:cache
Output: Compiled views cleared successfully.\nBlade templates cached successfully.
php artisan view:clear
Clear all compiled view files
Usage: php artisan view:clear
Example: php artisan view:clear
Output: Compiled views cleared successfully.
php artisan event:cache
Discover and cache event listeners
Usage: php artisan event:cache
Example: php artisan event:cache
Output: Events cached successfully.
php artisan event:clear
Clear all cached events and listeners
Usage: php artisan event:clear
Example: php artisan event:clear
Output: Cached events cleared successfully.
php artisan event:list
List the application events and their listeners
Usage: php artisan event:list [--event=...] [--sort=event|listener]
Example: php artisan event:list
Output: \n OrderShipped ............ App\Listeners\SendShipmentNotification\n Login ................... App\Listeners\LogSuccessfulLogin\n
php artisan queue:work
Start processing jobs on the queue as a daemon
Usage: php artisan queue:work [--queue=...] [--connection=...] [--once] [--max-jobs=N] [--max-time=N] [--stop-when-empty] [--tries=N] [--backoff=N] [--sleep=N]
Example: php artisan queue:work --queue=high,default --tries=3
Output: [2025-01-01 00:00:00][1] Processing: App\Jobs\ProcessPodcast\n[2025-01-01 00:00:01][1] Processed: App\Jobs\ProcessPodcast
php artisan queue:listen
Listen to a given queue (slower, but auto-reloads code)
Usage: php artisan queue:listen [--queue=...] [--timeout=N] [--tries=N]
Example: php artisan queue:listen --timeout=60
Output: Laravel development server started: <info>http://0.0.0.0:8000</info>
php artisan queue:restart
Restart queue worker daemons after their current job
Usage: php artisan queue:restart
Example: php artisan queue:restart
Output: Broadcasting queue restart signal.
php artisan queue:failed
List all of the failed queue jobs
Usage: php artisan queue:failed [--queue=...] [-v]
Example: php artisan queue:failed
Output: +----+--------+--------+---------------------+----------+\n| ID | Connection | Queue | Class | Failed At |
php artisan queue:retry
<id|all>
Retry a failed queue job (by ID, range, or all)
Usage: php artisan queue:retry [id...] [--queue=...] [--range=...] [all]
Example: php artisan queue:retry all
Output: The failed job [ce7bb0ea-a16e-4aca-9c5d-bd2dfb1a02c8] has been pushed back onto the queue!
php artisan queue:flush
Flush all of the failed queue jobs
Usage: php artisan queue:flush
Example: php artisan queue:flush
Output: All failed jobs deleted successfully!
php artisan queue:prune-failed
Prune stale entries from the failed jobs table
Usage: php artisan queue:prune-failed [--hours=N]
Example: php artisan queue:prune-failed --hours=24
Output: Pruning stale failed jobs older than 24 hours.
php artisan queue:prune-batches
Prune stale entries from the batches table
Usage: php artisan queue:prune-batches [--hours=N] [--unfinished=N] [--cancelled=N]
Example: php artisan queue:prune-batches --hours=48
Output: Pruning stale batches older than 48 hours.
php artisan queue:clear
Delete all of the jobs from the specified queue
Usage: php artisan queue:clear [--queue=...] [--force]
Example: php artisan queue:clear --queue=emails
Output: The [emails] queue has been cleared.
php artisan schedule:run
Run the scheduled commands (called by cron every minute)
Usage: php artisan schedule:run
Example: php artisan schedule:run
Output: Running scheduled tasks.\n Running: App\Console\Commands\SendEmails ... DONE (0.05s)
php artisan schedule:list
List all scheduled tasks with their cron expression and next run
Usage: php artisan schedule:list [--timezone=...]
Example: php artisan schedule:list
Output: +---+---------------------+---------------------+--------------------+----------------+\n| | Command | Interval | Next Due | Description |
php artisan schedule:test
Run a single scheduled command by name
Usage: php artisan schedule:test [--name=...]
Example: php artisan schedule:test
Output: Select a scheduled command to run:\n [0] emails:send\n [1] orders:purge
php artisan schedule:work
Start the schedule worker (runs every minute in foreground)
Usage: php artisan schedule:work [--stop-on-error] [--tries=N]
Example: php artisan schedule:work
Output: Running scheduled tasks every minute. Press Ctrl+C to exit.
php artisan schedule:interrupt
Interrupt the running schedule:work process
Usage: php artisan schedule:interrupt
Example: php artisan schedule:interrupt
Output: Interrupting schedule worker.
php artisan auth:clear-resets
Flush expired password reset tokens from the database
Usage: php artisan auth:clear-resets [--guard=...]
Example: php artisan auth:clear-resets
Output: Expired reset tokens cleared successfully.
php artisan sanctum:prune-expired
Prune Sanctum API tokens that have expired (requires Sanctum)
Usage: php artisan sanctum:prune-expired [--hours=N] [--model=...]
Example: php artisan sanctum:prune-expired --hours=24
Output: Tokens older than [24] hours pruned successfully.
php artisan notifications:table
Create a migration for the notifications table (for database channel)
Usage: php artisan notifications:table [--database=...]
Example: php artisan notifications:table
Output: Migration created successfully!
php artisan vendor:publish
Publish any publishable assets from vendor packages
Usage: php artisan vendor:publish [--provider=...] [--tag=...] [--force] [--all]
Example: php artisan vendor:publish --tag=config
Output: Publishing complete.
php artisan package:discover
Rebuild the cached package manifest (auto-discovered packages)
Usage: php artisan package:discover
Example: php artisan package:discover
Output: INFO Package manifest generated successfully.\n 42 packages you depend on are audited and discovered.
No matching commands
Try a different search term, or browse the categories above.