Laravel Commands

Here's a full list of commonly used Artisan commands in Laravel (as of Laravel 12). Artisan is Laravel’s powerful CLI tool to help with development tasks like code generation, database management, queue handling, etc.

🔰 Basic Commands

CommandDescription
php artisan listShow all available commands
php artisan help <command>Show help for a specific command
php artisan inspireDisplay an inspirational quote
php artisan aboutShow Laravel version & environment info

⚙️ Configuration & Environment

CommandDescription
php artisan config:cacheCache the config files
php artisan config:clearClear the config cache
php artisan envDisplay the current environment
php artisan optimizeOptimize framework for better performance
php artisan route:cacheCache routes
php artisan route:clearClear route cache
php artisan view:cacheCompile all Blade templates
php artisan view:clearClear compiled Blade views

🧱 Code Generation

💡 Make Commands

CommandDescription
php artisan make:controllerCreate a controller
php artisan make:modelCreate a model
php artisan make:migrationCreate a new migration file
php artisan make:seederCreate a database seeder
php artisan make:factoryCreate a model factory
php artisan make:middlewareCreate middleware
php artisan make:requestCreate a form request class
php artisan make:commandCreate a custom Artisan command
php artisan make:jobCreate a queued job
php artisan make:eventCreate an event
php artisan make:listenerCreate an event listener
php artisan make:policyCreate a policy class
php artisan make:resourceCreate a JSON API resource
php artisan make:testCreate a test class
php artisan make:mailCreate a Mailable class
php artisan make:notificationCreate a Notification class
php artisan make:providerCreate a service provider

🛢️ Database & Migration

CommandDescription
php artisan migrateRun all outstanding migrations
php artisan migrate:rollbackRoll back the last batch of migrations
php artisan migrate:refreshRollback and re-run all migrations
php artisan migrate:freshDrop all tables and re-run migrations
php artisan db:seedRun database seeders
php artisan migrate:statusView the status of each migration
php artisan schema:dumpDump the current database schema

🧪 Testing

CommandDescription
php artisan testRun feature/unit tests
php artisan duskRun Laravel Dusk browser tests (if installed)

📬 Queue & Jobs

CommandDescription
php artisan queue:workStart processing jobs
php artisan queue:listenListen to the queue continuously
php artisan queue:restartRestart all queue workers
php artisan queue:retryRetry failed jobs
php artisan queue:failedView failed jobs
php artisan queue:flushFlush all failed jobs
php artisan queue:tableGenerate migration for jobs table

🔐 Authorization

CommandDescription
php artisan make:policyCreate a new policy
php artisan make:ruleCreate a custom validation rule

🛰️ Routes & Caching

CommandDescription
php artisan route:listShow all registered routes
php artisan route:cacheCache routes for faster performance
php artisan route:clearClear the route cache

🧹 Cache & Maintenance

CommandDescription
php artisan cache:clearClear the application cache
php artisan cache:forgetRemove an item from cache store
php artisan config:cacheCache the config
php artisan downPut the app in maintenance mode
php artisan upBring the app out of maintenance

🌐 Others

CommandDescription
php artisan serveStart a local dev server (localhost:8000)
php artisan storage:linkCreate symbolic link to /public/storage
php artisan event:cacheCache all events and listeners
php artisan event:clearClear the cached events and listeners