Garm
Menu
Cheatsheets
laravel logo

Laravel Artisan

By Murilo Motta · October 2, 2026 · 10 min read

On this page

🧰 Built-in Commands

Available in every Laravel app out of the box.

🚀 Getting Started

list

Shows all available commands

php artisan list
  <namespace>       only commands in a group
  e.g.              php artisan list make

help

Shows a command's description, arguments and options

php artisan help <command>
  e.g.              php artisan help migrate
                    php artisan migrate --help   (same thing)

about

Shows app info: Laravel/PHP versions, environment, drivers, cache status

php artisan about
  --only=<section>  show one section (environment, cache, drivers)
  e.g.              php artisan about --only=environment

serve

Starts a local development server

php artisan serve
  --host=<ip>       host to bind (default 127.0.0.1)
  --port=<port>     port to use (default 8000)
  e.g.              php artisan serve --host=0.0.0.0 --port=8080

tinker

Opens an interactive PHP shell with your app loaded

php artisan tinker
  e.g.              > User::count()
                    > User::factory()->create()
                    > exit

key:generate

Generates the app encryption key (APP_KEY in .env)

php artisan key:generate
  --show            print the key without saving it
  --force           run in production

🏗️ Generators

All make:* commands create files in the right folder with boilerplate ready.

make:model

Creates an Eloquent model, and optionally its related files

php artisan make:model <Name>
  -m                also create a migration
  -c                also create a controller
  -r                controller is a resource controller
  -f                also create a factory
  -s                also create a seeder
  -p                also create a policy
  -R                also create form requests
  -a                all of the above
  --api             controller is an API controller
  e.g.              php artisan make:model Post -mcfs

make:controller

Creates a controller

php artisan make:controller <Name>
  -r                resource controller (index, store, show...)
  --api             resource controller without create/edit
  --model=<Model>   type-hint a model in the methods
  -i                invokable, single-action controller
  -R                also create form requests
  e.g.              php artisan make:controller PostController -r --model=Post

make:migration

Creates a database migration

php artisan make:migration <name>
  --create=<table>  migration that creates a table
  --table=<table>   migration that modifies a table
  e.g.              php artisan make:migration create_posts_table
                    php artisan make:migration add_slug_to_posts_table
                    (Laravel guesses the table from the name)

make:seeder

Creates a database seeder

php artisan make:seeder <Name>
  e.g.              php artisan make:seeder PostSeeder

make:factory

Creates a model factory for fake data

php artisan make:factory <Name>
  --model=<Model>   link it to a model
  e.g.              php artisan make:factory PostFactory --model=Post

make:request

Creates a form request for validation

php artisan make:request <Name>
  e.g.              php artisan make:request StorePostRequest

make:resource

Creates an API resource to shape JSON responses

php artisan make:resource <Name>
  --collection      create a resource collection
  e.g.              php artisan make:resource PostResource

make:middleware

Creates a middleware

php artisan make:middleware <Name>
  e.g.              php artisan make:middleware EnsureUserIsAdmin

make:policy

Creates an authorization policy

php artisan make:policy <Name>
  --model=<Model>   generate CRUD methods for a model
  e.g.              php artisan make:policy PostPolicy --model=Post

make:event / make:listener

Creates an event and a listener that reacts to it

php artisan make:event <Name>
php artisan make:listener <Name>
  --event=<Event>   listen to this event
  --queued          run the listener in the queue
  e.g.              php artisan make:event PostPublished
                    php artisan make:listener NotifyFollowers --event=PostPublished

make:job

Creates a job for the queue

php artisan make:job <Name>
  --sync            synchronous job (not queued)
  e.g.              php artisan make:job ProcessVideo

make:mail

Creates a mailable class

php artisan make:mail <Name>
  --markdown=<view> also create a Markdown email template
  e.g.              php artisan make:mail WelcomeMail --markdown=emails.welcome

make:notification

Creates a notification (mail, database, Slack...)

php artisan make:notification <Name>
  --markdown=<view> also create a Markdown template
  e.g.              php artisan make:notification InvoicePaid

make:command

Creates a custom Artisan command

php artisan make:command <Name>
  e.g.              php artisan make:command SendReports

make:component

Creates a Blade component

php artisan make:component <Name>
  --view            anonymous component (view only, no class)
  --inline          template inside the class
  e.g.              php artisan make:component Alert
                    php artisan make:component forms.input --view

make:test

Creates a test

php artisan make:test <Name>
  --unit            unit test instead of feature test
  --pest            Pest test instead of PHPUnit
  e.g.              php artisan make:test PostApiTest

make:class / enum / interface / trait

Creates plain PHP files

php artisan make:class <Name>
php artisan make:enum <Name>
php artisan make:interface <Name>
php artisan make:trait <Name>
  e.g.              php artisan make:enum PostStatus

🗄️ Database

migrate

Runs pending migrations

php artisan migrate
  --seed            run seeders afterwards
  --step            each migration in its own batch
  --pretend         show the SQL without running it
  --force           run in production
  e.g.              php artisan migrate --seed

migrate:rollback

Undoes the last batch of migrations

php artisan migrate:rollback
  --step=<N>        undo the last N migrations
  e.g.              php artisan migrate:rollback --step=1

migrate:fresh

Drops all tables and runs every migration from scratch (⚠️ deletes data)

php artisan migrate:fresh
  --seed            run seeders afterwards
  e.g.              php artisan migrate:fresh --seed

migrate:refresh

Rolls back all migrations, then runs them again (⚠️ deletes data)

php artisan migrate:refresh
  --seed            run seeders afterwards
  --step=<N>        only redo the last N migrations

migrate:status

Shows which migrations have run

php artisan migrate:status

db:seed

Fills the database with seed data

php artisan db:seed
  --class=<Seeder>  run one specific seeder
  --force           run in production
  e.g.              php artisan db:seed --class=PostSeeder

db:show / db:table

Shows database overview or details of one table

php artisan db:show
php artisan db:table <table>
  e.g.              php artisan db:table users

model:show

Shows a model's attributes, relations and observers

php artisan model:show <Model>
  e.g.              php artisan model:show Post

db

Opens the database's command-line client

php artisan db
  e.g.              php artisan db   (opens mysql / psql / sqlite3)

⚡ Cache & Optimization

optimize / optimize:clear

Caches (or clears) config, routes, views and events in one go

php artisan optimize          cache everything (use in production)
php artisan optimize:clear    clear everything (fixes "why isn't my change showing?")

config:cache / config:clear

Caches or clears the config files

php artisan config:cache
php artisan config:clear
  ⚠️                once cached, env() calls outside config files return null

route:cache / route:clear

Caches or clears the routes

php artisan route:cache
php artisan route:clear

view:cache / view:clear

Compiles or clears Blade views

php artisan view:cache
php artisan view:clear

cache:clear

Clears the application cache (Cache:: data)

php artisan cache:clear
  <store>           clear a specific store
  e.g.              php artisan cache:clear redis

🛣️ Routes

route:list

Shows all registered routes

php artisan route:list
  --name=<text>     filter by route name
  --path=<text>     filter by URL
  --method=<verb>   filter by HTTP method
  --except-vendor   hide package routes
  -v                also show middleware
  e.g.              php artisan route:list --path=api --except-vendor

⏱️ Queues & Scheduling

queue:work

Processes jobs from the queue

php artisan queue:work
  --queue=<names>   which queues, in priority order
  --tries=<N>       attempts before a job fails
  --timeout=<sec>   max seconds per job
  --once            process a single job
  --stop-when-empty exit when the queue is empty
  e.g.              php artisan queue:work --queue=high,default --tries=3

queue:listen

Processes jobs, reloading code on each job (slower, handy in development)

php artisan queue:listen

queue:restart

Restarts workers gracefully after their current job (run after each deploy)

php artisan queue:restart

queue:failed / queue:retry

Lists failed jobs and retries them

php artisan queue:failed
php artisan queue:retry <id>
  all               retry every failed job
  e.g.              php artisan queue:retry all

queue:flush

Deletes all failed jobs

php artisan queue:flush

schedule:list

Shows all scheduled tasks and when they run next

php artisan schedule:list

schedule:work

Runs the scheduler every minute locally (no cron needed)

php artisan schedule:work

schedule:run

Runs due scheduled tasks once (what the server cron calls)

php artisan schedule:run
  cron              * * * * * cd /path && php artisan schedule:run >> /dev/null 2>&1

🔧 Maintenance & Misc

down / up

Puts the app into or out of maintenance mode

php artisan down
  --secret=<token>  bypass URL: /<token> lets you in
  --render=<view>   view to show visitors
  --retry=<sec>     Retry-After header value
php artisan up
  e.g.              php artisan down --secret=letmein

Creates the public/storage symlink so uploaded files are reachable

php artisan storage:link

vendor:publish

Copies a package's config, views or migrations into your app

php artisan vendor:publish
  --tag=<tag>       publish only this group
  --provider=<cls>  publish from one service provider
  --force           overwrite existing files
  e.g.              php artisan vendor:publish --tag=laravel-errors

config:publish

Publishes framework config files hidden by default

php artisan config:publish <name>
  --all             publish every config file
  e.g.              php artisan config:publish cors

install:api / install:broadcasting

Sets up API routes + Sanctum, or broadcasting + Reverb

php artisan install:api
php artisan install:broadcasting

test

Runs the test suite

php artisan test
  --filter=<name>   run matching tests only
  --parallel        run tests in parallel
  --coverage        show code coverage (needs Xdebug or PCOV)
  e.g.              php artisan test --filter=PostApiTest

env

Shows the current environment

php artisan env

📦 Package Commands

Official Laravel packages that add their own commands once installed (composer require ...).

🔍 Debugging & Monitoring

pail

Tails your logs live in the terminal (Laravel Pail, included in new apps)

php artisan pail
  --filter=<text>   only matching entries
  --level=<level>   only this log level (error, warning...)
  -v                show full stack traces
  e.g.              php artisan pail --level=error

telescope:*

Debug dashboard for requests, queries, jobs (Laravel Telescope)

php artisan telescope:install
php artisan telescope:prune
  --hours=<N>       keep only the last N hours of entries

pulse:*

Production performance dashboard (Laravel Pulse)

php artisan pulse:check      capture server stats (keep it running)
php artisan pulse:work       process ingested entries
php artisan pulse:clear      delete all Pulse data

⏱️ Queues & Realtime

horizon

Runs and monitors Redis queues with a dashboard (Laravel Horizon)

php artisan horizon:install
php artisan horizon              start the workers
php artisan horizon:status       is it running?
php artisan horizon:terminate    graceful stop (run after each deploy)

reverb:start

Starts the WebSocket server (Laravel Reverb)

php artisan reverb:start
  --host=<ip>       host to bind
  --port=<port>     port (default 8080)
  --debug           show activity in the terminal

🚀 Performance & Environment

octane:*

Serves the app with a high-performance server (Laravel Octane)

php artisan octane:install
php artisan octane:start
  --watch           restart when files change
  --workers=<N>     number of workers
php artisan octane:reload        reload workers after deploy

sail:install

Sets up Docker with Laravel Sail

php artisan sail:install
  --with=<services> pick services (mysql, pgsql, redis...)
  e.g.              php artisan sail:install --with=pgsql,redis
                    ./vendor/bin/sail up -d   (then run artisan via "sail artisan")

🧩 Features

scout:*

Syncs models with a search engine (Laravel Scout)

php artisan scout:import "<Model>"    index all records
php artisan scout:flush "<Model>"     remove all records from the index
  e.g.              php artisan scout:import "App\Models\Post"

make:livewire

Creates a Livewire component (Livewire)

php artisan make:livewire <Name>
  e.g.              php artisan make:livewire CreatePost