Artisan CLI Reference
Laravel Artisan Commands Reference
Laravel Framework 12.17.0
Table of Contents
- Global Options
- Core Commands
- Authentication Commands
- Cache Commands
- Channel Commands
- Configuration Commands
- Database Commands
- Environment Commands
- Event Commands
- Import Commands
- Installation Commands
- Key Commands
- Language Commands
- Livewire Commands
- Make Commands
- Migration Commands
- Model Commands
- Optimization Commands
- Package Commands
- Queue Commands
- Route Commands
- Sail Commands
- Schedule Commands
- Schema Commands
- Storage Commands
- Stub Commands
- Vendor Commands
- View Commands
Global Options
All commands support these global options:
-h, --help
- Display help for the given command--silent
- Do not output any message-q, --quiet
- Only errors are displayed. All other output is suppressed-V, --version
- Display this application version--ansi|--no-ansi
- Force (or disable —no-ansi) ANSI output-n, --no-interaction
- Do not ask any interactive question--env[=ENV]
- The environment the command should run under-v|vv|vvv, --verbose
- Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Core Commands
about
Display basic information about your application including Laravel version, PHP version, environment, and other system details.
clear-compiled
Remove the compiled class file to force recompilation of framework classes.
completion
Dump the shell completion script for bash/zsh auto-completion of artisan commands.
db
Start a new database CLI session, launching the appropriate database client (mysql, psql, etc.) with your configured connection.
docs
Access the Laravel documentation directly from the command line.
down
Put the application into maintenance/demo mode, displaying a maintenance page to visitors while allowing authorized users access.
env
Display the current framework environment (local, production, staging, etc.).
help
Display help for a command. When no command is given, display help for the list command.
Options:
--format=FORMAT
- The output format (txt, xml, json, or md) [default: “txt”]--raw
- To output raw command help
inspire
Display an inspiring quote to motivate your development work.
list
List all available commands with brief descriptions.
migrate
Run the database migrations to update your database schema to the latest version.
optimize
Cache framework bootstrap, configuration, and metadata to increase application performance.
pail
Tail the application logs in real-time, useful for debugging and monitoring.
serve
Serve the application on the PHP development server for local development.
test
Run the application tests using PHPUnit or Pest.
tinker
Interact with your application through an interactive REPL (Read-Eval-Print Loop) shell.
up
Bring the application out of maintenance mode, making it accessible to all users again.
Authentication Commands
auth:clear-resets
Flush expired password reset tokens from the database to clean up old reset requests.
Cache Commands
cache:clear
Flush the entire application cache, removing all cached data.
cache:forget
Remove a specific item from the cache by its key.
cache:prune-stale-tags
Prune stale cache tags from the cache (Redis only) to clean up unused tag references.
Channel Commands
channel:list
List all registered private broadcast channels in your application.
Configuration Commands
config:cache
Create a cache file for faster configuration loading by pre-compiling all config files.
config:clear
Remove the configuration cache file, forcing config files to be read fresh on next request.
config:publish
Publish configuration files to your application, making vendor config files customizable.
config:show
Display all values for a given configuration file or specific configuration key.
Database Commands
db:monitor
Monitor the number of connections on the specified database to track usage patterns.
db:seed
Seed the database with records using your defined seeder classes.
db:show
Display detailed information about the given database including tables, size, and connection details.
db:table
Display information about a specific database table including columns, indexes, and relationships.
db:wipe
Drop all tables, views, and types from the database. Use with extreme caution!
Environment Commands
env:decrypt
Decrypt an environment file that was previously encrypted for secure storage.
env:encrypt
Encrypt an environment file to securely store sensitive configuration data.
Event Commands
event:cache
Discover and cache the application’s events and listeners for improved performance.
event:clear
Clear all cached events and listeners, forcing rediscovery on next request.
event:list
List all of the application’s events and their registered listeners.
Import Commands
import:users
Import users from a CSV file into your application’s user table.
Installation Commands
install:api
Create an API routes file and install Laravel Sanctum or Laravel Passport for API authentication.
install:broadcasting
Create a broadcasting channel routes file for real-time event broadcasting setup.
Key Commands
key:generate
Set the application key used for encryption and security. Required for new installations.
Language Commands
lang:publish
Publish all language files that are available for customization, allowing you to modify translations.
Livewire Commands
livewire:attribute
Create a new Livewire attribute class for custom component attributes.
livewire:configure-s3-upload-cleanup
Configure temporary file upload S3 directory to automatically cleanup files older than 24 hours.
livewire:copy
Copy an existing Livewire component to create a new one based on it.
livewire:delete
Delete a Livewire component and its associated files.
livewire:form
Create a new Livewire form class for handling form logic.
livewire:layout
Create a new app layout file for Livewire components.
livewire:make
Create a new Livewire component with both class and view files.
livewire:move
Move a Livewire component to a different location/namespace.
livewire:publish
Publish Livewire configuration files for customization.
livewire:stubs
Publish Livewire stub files for customizing generated component templates.
livewire:upgrade
Interactive upgrade helper to migrate from Livewire v2 to v3.
Make Commands
make:cache-table
(alias: cache:table
)
Create a migration for the cache database table when using database cache driver.
make:cast
Create a new custom Eloquent cast class for transforming model attributes.
make:channel
Create a new channel class for broadcasting authorization logic.
make:class
Create a new generic PHP class file.
make:command
Create a new custom Artisan command class.
make:component
Create a new view component class for reusable UI components.
make:controller
Create a new controller class for handling HTTP requests.
make:enum
Create a new enum class for type-safe constants.
make:event
Create a new event class for the event system.
make:exception
Create a new custom exception class for error handling.
make:factory
Create a new model factory for generating test data.
make:interface
Create a new PHP interface for defining contracts.
make:job
Create a new job class for queued background processing.
make:job-middleware
Create a new job middleware class for processing jobs.
make:listener
Create a new event listener class to handle events.
make:livewire
Create a new Livewire component (same as livewire:make
).
make:mail
Create a new mailable email class.
make:middleware
Create a new HTTP middleware class for request filtering.
make:migration
Create a new migration file for database schema changes.
make:model
Create a new Eloquent model class for database interactions.
make:notification
Create a new notification class for sending notifications.
make:notifications-table
(alias: notifications:table
)
Create a migration for the notifications table when using database notification driver.
make:observer
Create a new observer class for monitoring model events.
make:policy
Create a new policy class for authorization logic.
make:provider
Create a new service provider class for registering services.
make:queue-batches-table
(alias: queue:batches-table
)
Create a migration for the batches database table for job batching.
make:queue-failed-table
(alias: queue:failed-table
)
Create a migration for the failed queue jobs database table.
make:queue-table
(alias: queue:table
)
Create a migration for the queue jobs database table.
make:request
Create a new form request class for validation and authorization.
make:resource
Create a new API resource class for transforming models to JSON.
make:rule
Create a new custom validation rule class.
make:scope
Create a new query scope class for reusable query logic.
make:seeder
Create a new seeder class for populating database with test data.
make:session-table
(alias: session:table
)
Create a migration for the session database table when using database session driver.
make:test
Create a new test class for PHPUnit or Pest testing.
make:trait
Create a new PHP trait for shared functionality.
make:view
Create a new Blade view template file.
Migration Commands
migrate:fresh
Drop all tables and re-run all migrations from scratch. Destructive operation!
migrate:install
Create the migration repository table to track migration status.
migrate:refresh
Reset and re-run all migrations, preserving seeded data.
migrate:reset
Rollback all database migrations to empty state.
migrate:rollback
Rollback the last database migration or a specified number of migrations.
migrate:status
Show the status of each migration (ran/pending).
Model Commands
model:prune
Prune models that are no longer needed based on their prunable configuration.
model:show
Show detailed information about an Eloquent model including attributes, relationships, and observers.
Optimization Commands
optimize:clear
Remove all cached bootstrap files (config, routes, views, etc.) for development.
Package Commands
package:discover
Rebuild the cached package manifest, useful after installing new packages.
Queue Commands
queue:clear
Delete all jobs from the specified queue.
queue:failed
List all failed queue jobs with details about failures.
queue:flush
Flush all failed queue jobs from the failed jobs table.
queue:forget
Delete a specific failed queue job by ID.
queue:listen
Listen to a given queue and process jobs as they arrive.
queue:monitor
Monitor the size of specified queues and alert when thresholds are exceeded.
queue:prune-batches
Prune stale entries from the batches database to clean up old batch records.
queue:prune-failed
Prune stale entries from the failed jobs table.
queue:restart
Restart queue worker daemons after their current job completes.
queue:retry
Retry a specific failed queue job by ID.
queue:retry-batch
Retry all failed jobs for a specific batch.
queue:work
Start processing jobs on the queue as a daemon process.
Route Commands
route:cache
Create a route cache file for faster route registration in production.
route:clear
Remove the route cache file, useful during development.
route:list
List all registered routes with their methods, URIs, names, and actions.
Sail Commands
sail:add
Add a service to an existing Laravel Sail installation.
sail:install
Install Laravel Sail’s default Docker Compose file for containerized development.
sail:publish
Publish the Laravel Sail Docker files for customization.
Schedule Commands
schedule:clear-cache
Delete the cached mutex files created by the scheduler.
schedule:interrupt
Interrupt the current schedule run.
schedule:list
List all scheduled tasks with their frequency and next run time.
schedule:run
Run the scheduled commands (typically called by cron).
schedule:test
Run a specific scheduled command for testing purposes.
schedule:work
Start the schedule worker to run scheduled tasks without requiring cron.
Schema Commands
schema:dump
Dump the given database schema to a file for version control or backup.
Storage Commands
storage:link
Create symbolic links configured for the application (typically public storage).
storage:unlink
Delete existing symbolic links configured for the application.
Stub Commands
stub:publish
Publish all stub files that are available for customization, allowing you to modify code generation templates.
Vendor Commands
vendor:publish
Publish any publishable assets from vendor packages (config files, views, etc.).
View Commands
view:cache
Compile all of the application’s Blade templates for improved performance.
view:clear
Clear all compiled view files, forcing recompilation on next request.
Usage: php artisan [command] [options] [arguments]
For detailed help on any command, use: php artisan help [command]