Artisan & workflows
artisanis the project's CLI. Think npm scripts + code generators + ops switches in one binary.
Everyday commands
bash
php artisan serve
php artisan route:list
php artisan migrate
php artisan migrate:fresh --seed # wipe DB - never on prod
php artisan tinker # REPL with app bootstrapped
php artisan about
php artisan make:controller PostController --resource
php artisan make:model Post -mfs # model, migration, factory, seeder
php artisan make:request StorePostRequest
php artisan make:middleware …
php artisan test
php artisan config:clear
php artisan cache:clear
php artisan view:clearComments for the list above:
tinkeris incredible for poking Eloquent without writing a throwaway routemake:*generators keep namespaces/folders consistent*:clearcommands fix "I changed config but nothing happened" (often config cache in prod)
Custom commands
bash
php artisan make:command SendWeeklyReportphp
<?php
protected $signature = 'report:weekly {--dry-run}';
public function handle(): int
{
// …
return self::SUCCESS;
}Schedule in routes/console.php / bootstrap schedule (version-dependent) - cron hits php artisan schedule:run every minute in production.
Workflow I actually use
route:listwhen lostmake:model -mthen fill migrationmigrate- Controller + Form Request
- Blade views
- Feature test
pint/ formatter if the team uses it
Artisan doesn't replace thinking - it removes typing.
Best,
-- ł.