laravel/sail
Docker-based local dev environment for Laravel on macOS, Windows (WSL2), and Linux. Sail provides ready-to-use containers and a simple CLI so you can start developing without installing extra tools beyond Docker, even with no Docker experience.
Laravel Sail is a first-class fit for Laravel-based applications, offering a Docker-powered local development environment that abstracts infrastructure complexity. Its modular design (compose-based services for MySQL, PostgreSQL, Redis, etc.) aligns with Laravel’s ecosystem, reducing friction for teams already using Docker. The package’s opinionated but extensible approach (e.g., preconfigured PHP versions, Node.js, and database services) ensures consistency while allowing customization via .env or docker-compose.override.yml.
Key strengths:
.env files, and service providers (e.g., queues, caching).Potential misfits:
Low-risk for Laravel apps: Sail is batteries-included for new Laravel projects (via laravel/new scaffolding) and can be retrofitted into existing ones with minimal effort. The sail:install Artisan command automates setup, and the package’s dependency on Docker (not Docker Compose directly) simplifies adoption.
Critical integration points:
php artisan with sail artisan, requiring zero code changes but necessitating team training.php artisan → sail artisan) could cause confusion..env files for databases/queues, but custom .env values must be preserved during migration.storage/logs/laravel.log) may break if Sail’s volume mounts differ from local setups.docker-compose.override.yml additions.php-redis) may need explicit installation.Migration Path:
laravel/sail from day one (recommended).composer require laravel/sail --dev).sail build --no-cache to generate containers..env to match Sail’s defaults (e.g., DB_HOST=sail-mysql).php artisan with sail artisan in scripts.| Risk Area | Severity | Mitigation |
|---|---|---|
| Docker Dependency | High | Enforce Docker Desktop (macOS/Windows) or Podman (Linux) as a dev requirement. |
| PHP Version Mismatches | Medium | Pin PHP versions in sail --php=8.2 or override Dockerfiles. |
| Volume Permissions | Medium | Use sail artisan storage:link and ensure storage/ is writable. |
| CI/CD Pipeline Changes | High | Update pipelines to use sail commands or Docker-in-Docker (DinD). |
| Legacy Extensions | Low | Check ext-* in php.ini; Sail may lack niche extensions (e.g., swoole). |
| Networking Issues | Medium | Use sail up -d and verify service health with sail ps. |
Critical Questions for TPM:
pdo_pgsql, gd)?.env files) be handled in shared environments?Sail is optimized for the Laravel stack and integrates tightly with:
Non-Laravel Compatibility:
compose.yaml can be repurposed for non-Laravel PHP apps, but lose Sail’s Laravel-specific conveniences (e.g., Artisan proxying).docker-compose directly if Sail’s Laravel-centric features aren’t needed.composer create-project laravel/laravel new-project
cd new-project
sail build --no-cache
sail up
sail artisan migrate).sail test).sail artisan queue:work)..env changes).docker-compose.override.yml to extend Sail (e.g., add Elasticsearch).phpunit with sail test in pipelines.docker-compose or GitHub Actions’ Docker support for CI.sail commands vs. native PHP CLI..env:
DB_HOST=sail-mysql).php artisan with sail artisan in:
package.json scripts.Makefile/Rakefile tasks.README.md as the only supported local environment.| Component | Sail Compatibility | Workarounds |
|---|---|---|
| Laravel 10/11/12 | ✅ Full support | Use sail --php=8.2 for older Laravel versions. |
| Custom Dockerfiles | ⚠️ Partial (override via .env or compose.override.yml) |
Extend Sail’s base images or use multi-stage builds. |
| Legacy PHP (<8.1) | ❌ Not supported | Use a custom Dockerfile or downgrade Sail (not recommended). |
| Windows (non-WSL2) | ❌ Poor performance | Enforce WSL2 or macOS/L |
How can I help you explore Laravel packages today?