© 2025 Anas Al-Ashqar. All rights reserved. GitHub | LinkedIn

Project Setup & Management

Command Description
composer create-project --prefer-dist laravel/laravel example-app "11.*"
Create a new Laravel 11.x project
composer create-project --prefer-dist laravel/laravel project-name
Create a new Laravel project with the latest stable version
php artisan serve
Start the Laravel development server
php artisan key:generate
Generate application encryption key
php artisan about
Display information about the current Laravel installation
php artisan down
Put the application into maintenance mode
php artisan up
Bring the application out of maintenance mode
php artisan optimize
Cache the framework bootstrap files
php artisan optimize:clear
Remove the cached bootstrap files

Database & Migration Commands

Command Description
php artisan migrate
Run all pending migrations
php artisan migrate:fresh
Drop all tables and re-run all migrations
php artisan migrate:refresh
Roll back all migrations and re-run them
php artisan migrate:reset
Roll back all migrations
php artisan migrate:rollback
Roll back the last migration operation
php artisan migrate:status
Show the status of each migration
php artisan db:seed
Seed the database with records
php artisan db:wipe
Drop all tables, views, and types

Creating Files

Command Description
php artisan make:model ModelName
Create a new Eloquent model class
php artisan make:model ModelName -m
Create a model with a migration file
php artisan make:model ModelName -mc
Create a model with migration and controller
php artisan make:controller ControllerName
Create a new controller class
php artisan make:controller ControllerName --resource
Create a new resource controller class
php artisan make:controller API/ControllerName --api
Create a new API controller class
php artisan make:migration create_table_name_table
Create a new migration file
php artisan make:seeder SeederName
Create a new database seeder class
php artisan make:middleware MiddlewareName
Create a new middleware class

Routes & Auth

Command Description
php artisan route:list
List all registered routes
php artisan route:cache
Create a route cache file for faster route registration
php artisan route:clear
Remove the route cache file
php artisan make:auth
Scaffold basic login and registration views (for Laravel < 6.0)
composer require laravel/ui && php artisan ui bootstrap --auth
Create auth scaffolding with Bootstrap in Laravel 6+

Cache & Configuration

Command Description
php artisan config:cache
Create a cache file for faster configuration loading
php artisan config:clear
Remove the configuration cache file
php artisan view:cache
Compile all Blade templates
php artisan view:clear
Clear all compiled view files
php artisan cache:clear
Flush the application cache

Queues & Jobs

Command Description
php artisan make:job JobName
Create a new job class
php artisan queue:table
Create a migration for the queue jobs database table
php artisan queue:work
Start processing jobs on the queue as a daemon
php artisan queue:restart
Restart queue worker daemons after their current job
php artisan queue:failed
List all of the failed queue jobs

Testing

Command Description
php artisan make:test TestName
Create a new test class
php artisan make:test TestName --unit
Create a new unit test class
php artisan test
Run the application's tests

Composer Commands

Command Description
composer install
Install project dependencies from composer.lock
composer update
Update project dependencies to latest versions
composer require package/name
Add a new package to the project
composer require --dev package/name
Add a development dependency to the project
composer dump-autoload
Update the autoloader when new classes are added

Laravel Sail (Docker)

Command Description
./vendor/bin/sail up
Start all Docker containers
./vendor/bin/sail up -d
Start all Docker containers in detached mode
./vendor/bin/sail down
Stop all Docker containers
./vendor/bin/sail artisan command
Run an Artisan command in the Docker container
./vendor/bin/sail composer require package
Run Composer commands within the Docker container

Advanced Commands

Command Description
php artisan make:command CommandName
Create a new Artisan command
php artisan make:event EventName
Create a new event class
php artisan make:listener ListenerName
Create a new event listener class
php artisan make:policy PolicyName
Create a new policy class
php artisan make:provider ProviderName
Create a new service provider class
php artisan schedule:list
List the scheduled commands
php artisan schedule:run
Run the scheduled commands
Command copied to clipboard!