laravel/sail
Laravel Sail offers a Docker-powered local development environment for Laravel on macOS, Windows (WSL2), and Linux. With a simple CLI and no extra dependencies beyond Docker, it lets you spin up a full dev stack quickly—even without Docker experience.
Laravel Sail is a first-class fit for PHP/Laravel-based applications, particularly those leveraging Docker for local development. Its pre-configured Docker stack (PHP, MySQL, PostgreSQL, Redis, Mailpit, etc.) aligns seamlessly with Laravel’s ecosystem, eliminating the need for manual Docker orchestration. The package abstracts infrastructure concerns, allowing developers to focus on application logic while maintaining consistency across environments.
Key strengths:
Potential misfits:
.env handling, Artisan integration) may require workarounds.Low-risk for Laravel apps: Sail integrates via a single composer require and minimal configuration. The sail CLI replaces php artisan serve, and Docker Compose handles the rest. Laravel’s default .env and Dockerfile templates are Sail-compatible out of the box.
Non-Laravel PHP apps:
compose.yaml, .env, and entrypoints (e.g., public/index.php instead of artisan serve).Key integration points:
php artisan serve with sail up..env to use service names (e.g., DB_HOST=sail-mysql).sail artisan migrate).compose.yaml for additional services (e.g., Elasticsearch).| Risk Area | Severity | Mitigation |
|---|---|---|
| Docker dependency | Medium | Requires Docker Desktop (macOS/Windows) or Docker Engine (Linux). |
| Resource overhead | Low | Sail containers are lightweight, but local dev may need 4+ CPU cores/8GB RAM. |
| Laravel-specific quirks | Low | Non-Laravel apps need customization (e.g., entrypoint scripts). |
| Networking/port conflicts | Medium | Sail uses predefined ports; conflicts may require .env overrides. |
| State persistence | Low | Volumes persist data (e.g., databases), but backups are manual. |
| Debugging complexity | Medium | Docker logs require sail logs; XDebug needs extra config. |
Critical questions for TPMs:
Sail is optimized for the following stacks:
Compatibility matrix:
| Component | Sail Support | Notes |
|---|---|---|
| PHP (FPM/CLI) | ✅ Full | Multiple versions (8.0–8.5) supported. |
| MySQL/MariaDB | ✅ Full | 8.0–8.4 versions. |
| PostgreSQL | ✅ Full | 16–18 versions. |
| Redis | ✅ Full | Includes Valkey (Redis fork). |
| Mailpit | ✅ Full | Email testing. |
| RabbitMQ | ✅ Partial | Added in v1.42, but may need tuning. |
| MongoDB | ✅ Partial | Requires custom stub. |
| Elasticsearch | ❌ No | Not included; would need custom setup. |
| Kubernetes | ❌ No | Sail is Docker-only. |
Non-PHP services:
./vendor/laravel/sail/stubs/elasticsearch.stub) or extend compose.yaml.compose.yaml snippet for Kafka:
services:
kafka:
image: bitnami/kafka:latest
ports:
- "9092:9092"
For new Laravel projects:
composer require laravel/sail --dev
sail build --no-cache
sail up
.env to use Sail service names (e.g., DB_HOST=sail-mysql).php artisan serve with sail artisan serve.sail artisan migrate and sail artisan test.For existing projects:
localhost → sail-mysql).docker-compose.yml).php artisan serve with sail up..env and database configs.compose.yaml.sail exec to run legacy scripts if needed.Rollback strategy:
Dockerfile/docker-compose.yml.sail down to revert to pre-Sail state.| Compatibility Factor | Details |
|---|---|
| Laravel versions | v8.0+ (tested up to v13). Backward compatibility for older versions via sail:1.x tags. |
| PHP versions | 8.0–8.5 (via SAIL_PHP_VERSION env var). |
| Operating systems | macOS, Linux, Windows (WSL2). |
| Docker versions | Compatible with Docker Engine 20.10+ and Docker Desktop. |
| CI/CD | Works with GitHub Actions, GitLab CI, etc., but requires Docker-in-Docker (DinD) or emulators. |
| IDE support | VS Code (Dev Containers), PHPStorm (Docker integration), and others via remote development. |
Known incompatibilities:
php-redis) may need manual installation.Recommended adoption sequence:
How can I help you explore Laravel packages today?