Local development with Laravel Sail
⛵
Sail away.
The official, lightweight Docker development environment for Laravel.
Sail is Laravel's own take on a Docker-based local development environment. It's essentially a docker-compose.yml file and a CLI wrapper script stored in your project. It's a good match if you want a per-project isolated environment that matches the "Laravel way" of doing things.
Installation
It comes pre-installed with new Laravel projects. For existing ones:
composer require laravel/sail --dev php artisan sail:installbash
Usage
It's just Docker under the hood. You use the sail command to interact with it.
# Start the environment ./vendor/bin/sail up # Run artisan commands ./vendor/bin/sail artisan migrate # Run composer ./vendor/bin/sail composer require guzzlehttp/guzzlebash
Tip: Configure a shell alias so you can just type sail instead of ./vendor/bin/sail.
Comparison
Unlike Valet or Herd, Sail runs everything in containers. This means no pollution of your local machine, but it also means it's a bit heavier on resources (Docker Desktop required).
Working with fortrabbit
Sail is for local development. When you deploy to fortrabbit, you are pushing your code, not the Docker containers. The platform handles the runtime environment for you.