🚀 Basic DDEV Project Commands
| Command | Purpose |
|---|---|
ddev start |
Start your Laravel project environment |
ddev stop |
Stop the environment |
ddev restart |
Restart the environment (after config changes) |
ddev ssh |
SSH into the container (important for artisan commands, composer, etc.) |
ddev list |
List all running DDEV projects |
ddev describe |
Show project details and URL |
🛠 Laravel-Specific Workflow Inside the Container (ddev ssh)
| Command | Purpose |
|---|---|
php artisan migrate |
Run database migrations |
php artisan migrate:fresh |
Drop all tables and re-run all migrations |
php artisan db:seed |
Seed the database with dummy/test data |
php artisan make:model ModelName -m |
Create a new model and migration |
php artisan make:controller ControllerName |
Create a new controller |
php artisan make:migration create_table_name |
Create a new migration |
php artisan serve |
(Not needed usually with DDEV – you access via DDEV’s routing) |
📦 Composer Commands
| Command | Purpose |
|---|---|
composer install |
Install PHP dependencies (from composer.lock) |
composer update |
Update PHP dependencies |
composer dump-autoload |
Regenerate autoload files (after adding classes manually) |
🧹 Cache and Maintenance
| Command | Purpose |
|---|---|
php artisan config:cache |
Rebuild configuration cache |
php artisan route:cache |
Rebuild route cache |
php artisan view:clear |
Clear compiled Blade views |
php artisan cache:clear |
Clear application cache |
php artisan config:clear |
Clear config cache |
⚙️ Database Access
| Command | Purpose |
|---|---|
ddev mysql |
Open MySQL client connected to the Laravel database |
ddev sequelpro or ddev heidisql |
Launch database GUI apps connected to DDEV DB |
🧪 Testing and Development Extras
| Command | Purpose |
|---|---|
php artisan test |
Run PHPUnit tests |
php artisan tinker |
Open Tinker REPL to interact with app models/data |
Bonus 🌟
If you ever need to install Laravel inside DDEV from scratch:
ddev composer create "laravel/laravel my-project-name"
(inside your project’s /var/www/html directory after ddev ssh)
| Category | Command | DDEV Command | Purpose |
|---|---|---|---|
| General | php artisan list | ddev artisan list | Lists all available Artisan commands. |
| General | php artisan help | ddev artisan help | Displays help for a specific command. |
| General | php artisan about | ddev artisan about | Displays application information. |
| Environment & Config | php artisan env | ddev artisan env | Displays the current application environment. |
| Environment & Config | php artisan config:cache | ddev artisan config:cache | Creates a cache file for faster configuration loading. |
| Environment & Config | php artisan config:clear | ddev artisan config:clear | Clears the configuration cache. |
| Environment & Config | php artisan key:generate | ddev artisan key:generate | Sets the application key in the .env file. |
| Routing & Views | php artisan route:list | ddev artisan route:list | Lists all registered routes for the application. |
| Routing & Views | php artisan view:clear | ddev artisan view:clear | Clears all compiled view files. |
| Caching | php artisan cache:clear | ddev artisan cache:clear | Clears the application cache. |
| Caching | php artisan cache:forget | ddev artisan cache:forget | Removes an item from the cache. |
| Caching | php artisan cache:table | ddev artisan cache:table | Creates a migration for the cache database table. |
| Database & Migrations | php artisan migrate | ddev artisan migrate | Runs database migrations. |
| Database & Migrations | php artisan migrate:rollback | ddev artisan migrate:rollback | Rolls back the last database migration. |
| Database & Migrations | php artisan migrate:reset | ddev artisan migrate:reset | Rolls back all database migrations. |
| Database & Migrations | php artisan migrate:fresh | ddev artisan migrate:fresh | Drops all tables and re-runs all migrations. |
| Database & Migrations | php artisan migrate:refresh | ddev artisan migrate:refresh | Resets and re-runs all migrations. |
| Database & Migrations | php artisan db:seed | ddev artisan db:seed | Seeds the database with records. |
| Database & Migrations | php artisan make:migration | ddev artisan make:migration | Creates a new migration file. |
| Database & Migrations | php artisan make:seeder | ddev artisan make:seeder | Creates a new seeder class. |
| Models & Factories | php artisan make:model | ddev artisan make:model | Creates a new Eloquent model class. |
| Models & Factories | php artisan make:factory | ddev artisan make:factory | Creates a new model factory. |
| Controllers & Middleware | php artisan make:controller | ddev artisan make:controller | Creates a new controller class. |
| Controllers & Middleware | php artisan make:middleware | ddev artisan make:middleware | Creates a new middleware class. |
| Controllers & Middleware | php artisan make:command | ddev artisan make:command | Creates a new Artisan command. |
| Queues & Jobs | php artisan queue:work | ddev artisan queue:work | Starts processing jobs on the queue. |
| Queues & Jobs | php artisan queue:listen | ddev artisan queue:listen | Listens to a given queue. |
| Queues & Jobs | php artisan queue:restart | ddev artisan queue:restart | Restarts queue workers after their current job. |
| Queues & Jobs | php artisan queue:table | ddev artisan queue:table | Creates a migration for the jobs database table. |
| Events & Listeners | php artisan event:generate | ddev artisan event:generate | Generates missing event and listener classes. |
| Events & Listeners | php artisan make:event | ddev artisan make:event | Creates a new event class. |
| Events & Listeners | php artisan make:listener | ddev artisan make:listener | Creates a new event listener class. |
| Testing | php artisan test | ddev artisan test | Runs the application tests using PHPUnit. |
| Other | php artisan tinker | ddev artisan tinker | Opens an interactive shell to interact with your application. |
| Other | php artisan serve | ddev artisan serve | Serves the application on the PHP built-in server. |
| Other | php artisan schedule:run | ddev artisan schedule:run | Runs the scheduled tasks. |