# Laravel Sail Sail is a CLI for building [[Laravel]] applications using [[Docker]] and [[docker-compose]]. It's super useful to quickly build Laravel applications locally with PHP, MySQL, PostgreSQL, Redis. Everything, just like in production! It's very useful during development, but not required for production. ## Useful commands - Start Sail as a daemon: `./vendor/bin/sail up -d` - Run DB migrations: `./vendor/bin/sail artisan migrate` - Test: `./vendor/bin/sail test` or `./vendor/bin/sail test --group ...` (same as `sail artisan test`) - Runs tests against a dedicated testing database - Also configured for PHPUnit via `phpunit.xml` - Run commands through Sail - `sail php --version` - `sail artisan ...` - `sail composer ...` - `sail node ...` - `sail npm ...` - Shell within the container: `sail shell` or `sail root-shell` - Debug: `sail debug ..` - Reference: https://laravel.com/docs/11.x/sail#debugging-with-xdebug ## How to add Sail to an existing Laravel application Run the following command: `curl -s "https://laravel.build/example-app?with=pgsql,redis,meilisearch,selenium,mailhog" | bash` Check out the following page to see explanation about choosing the services to install along with Sail: https://laravel.com/docs/8.x#choosing-your-sail-services ## Tips Add the following alias for better DX: `alias: alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'` It makes it easier to run Sail commands. ## References - https://laravel.com/docs/11.x/sail ## Related - [[Laravel]]