artisan
Laravel's command-line interface for PHP development tasks.
TLDR
SYNOPSIS
php artisan command [arguments] [options]
DESCRIPTION
Artisan is Laravel's command-line interface for PHP web application development. It provides commands for common tasks like database migrations, code generation, cache management, and queue processing.The tool automates repetitive development tasks through its make: commands, which generate boilerplate code for controllers, models, migrations, tests, and other Laravel components. Database management is handled through migration commands that version-control schema changes.Tinker provides an interactive REPL (Read-Eval-Print Loop) for exploring the application, testing code snippets, and interacting with Eloquent models directly.Custom commands can be created with make:command and registered automatically from the app/Console/Commands directory. Commands support arguments, options, user prompts, and formatted output including tables and progress bars.
PARAMETERS
list
Display all available commandsserve
Start the built-in development servermigrate
Run database migrationsmigrate:rollback
Rollback the last database migrationmigrate:fresh
Drop all tables and re-run every migrationdb:seed
Run database seedersmake:controller name
Create a new controller classmake:model name
Create a new Eloquent modelmake:migration name
Create a new migration filemake:command name
Create a new Artisan commandmake:seeder name
Create a new database seeder classmake:factory name
Create a new model factorycache:clear
Clear the application cacheconfig:cache
Cache the configuration filesroute:list
List all registered routesqueue:work
Process jobs from the queueschedule:run
Run the scheduled tasks that are duevendor:publish
Publish package assets and configuration filesabout
Display a summary of the application's environment and configurationtinker
Open an interactive REPL shellkey:generate
Generate application encryption keyoptimize
Cache configuration, routes, and viewsoptimize:clear
Clear all cached files--help, -h
Display help for a command-v, -vv, -vvv
Increase verbosity of output--quiet, -q
Suppress all output--no-interaction, -n
Do not ask any interactive questions--version, -V
Display the application version--ansi, --no-ansi
Force or disable colored output--env=environment
Run command in a specific environment
CAVEATS
Must be run from the Laravel project root directory where the artisan file exists. Requires PHP to be installed and in the system PATH. Some commands like migrate require database configuration. When using Laravel Sail (Docker), prefix commands with sail instead of php.
HISTORY
Artisan was introduced with Laravel 3 in 2012 by Taylor Otwell, inspired by Symfony Console. It has grown with each Laravel release, adding new generators and utilities. The name references Laravel's positioning as "the framework for web artisans." Laravel Tinker, powered by PsySH, was added to provide interactive debugging capabilities.
