Here’s a table with 50 commonly used Laravel Artisan commands, properly sequenced and categorized for clarity:
Category | Command | Description |
---|---|---|
General | php artisan list | Displays a list of all available Artisan commands. |
php artisan serve | Serves the application on the PHP built-in web server. | |
php artisan tinker | Opens an interactive REPL to interact with the application. | |
php artisan env | Displays the current environment the application is running in. | |
php artisan key:generate | Sets the APP_KEY in the .env file. | |
php artisan optimize | Optimizes the framework for better performance. | |
Controllers | php artisan make:controller | Creates a new controller. |
Models | php artisan make:model | Creates a new Eloquent model class. |
Migrations | php artisan make:migration | Creates a new database migration. |
php artisan migrate | Runs the pending migrations. | |
php artisan migrate:rollback | Rolls back the last database migration. | |
php artisan migrate:fresh | Drops all tables and re-runs all migrations. | |
php artisan migrate:status | Displays the status of each migration. | |
Routing | php artisan route:list | Lists all registered routes. |
php artisan route:cache | Caches the application’s routes. | |
php artisan route:clear | Clears the route cache. | |
Middleware | php artisan make:middleware | Creates a new middleware class. |
Form Requests | php artisan make:request | Creates a new form request class. |
Database | php artisan make:seeder | Creates a new database seeder class. |
php artisan db:seed | Runs the database seeders. | |
php artisan make:factory | Creates a new model factory. | |
Cache Management | php artisan cache:clear | Clears the application cache. |
php artisan config:cache | Caches the application configuration. | |
php artisan config:clear | Clears the configuration cache. | |
php artisan view:clear | Clears compiled view files. | |
php artisan optimize:clear | Clears all compiled files and caches. | |
Jobs & Queues | php artisan make:job | Creates a new job class. |
php artisan queue:work | Starts processing jobs on the queue. | |
php artisan queue:restart | Restarts the queue worker after the current job finishes. | |
php artisan queue:table | Creates a migration for the jobs database table. | |
Events & Listeners | php artisan make:event | Creates a new event class. |
php artisan make:listener | Creates a new event listener class. | |
php artisan event:generate | Generates event and listener classes for registered events. | |
Policies & Authorization | php artisan make:policy | Creates a new authorization policy. |
Notifications | php artisan make:notification | Creates a new notification class. |
API Resources | php artisan make:resource | Creates a new API resource class. |
Observers | php artisan make:observer | Creates a new observer class for models. |
Console & Commands | php artisan make:command | Creates a new Artisan command. |
php artisan make:console | Creates a new console command. | |
Testing | php artisan make:test | Creates a new test class. |
php artisan test | Runs the application’s tests. | |
Providers | php artisan make:provider | Creates a new service provider class. |
Validation | php artisan make:rule | Creates a new custom validation rule. |
Storage | php artisan storage:link | Creates a symbolic link from public/storage to storage/app/public . |
Maintenance Mode | php artisan down | Puts the application into maintenance mode. |
php artisan up | Brings the application out of maintenance mode. | |
Vendor Management | php artisan vendor:publish | Publishes vendor package assets, configuration files, or views. |
Password Resets | php artisan auth:clear-resets | Flushes expired password reset tokens. |
This table organizes the commands based on their function within the Laravel ecosystem.