Documentation Index
Fetch the complete documentation index at: https://kawax.biz/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
Laravel Sail is a light-weight command-line interface for interacting with Laravel’s Docker development environment. Sail lets you build a Laravel application using PHP, MySQL, and Redis without requiring prior Docker experience. At its heart, Sail is thecompose.yaml file and the sail script stored at the root of your project.
The sail script provides a CLI with convenient methods for interacting with the Docker containers defined by the compose.yaml file.
Laravel Sail is supported on macOS, Linux, and Windows (via WSL2).
Sail is intended for local development only. It is not designed for production use.
For production deployments, consider Laravel Cloud, Forge, or your own Docker / Kubernetes setup.
Installation
Install in an Existing Project
Install the package via Composer and configure your environment.Publish the configuration
Run the An interactive prompt lets you choose services such as MySQL, Redis, and Mailpit.
sail:install Artisan command. It publishes a compose.yaml file to your project root and updates .env with the required environment variables.Add More Services
To add a service to an existing Sail installation, use thesail:add command.
Using Devcontainers
To develop inside a Devcontainer, pass the--devcontainer flag.
Configuration
Shell Alias
By default every Sail command requires typing./vendor/bin/sail. Configure a shell alias to save keystrokes.
~/.zshrc or ~/.bashrc, then restart your shell.
Rebuild Images
To ensure all packages are up to date, rebuild your Sail images with thebuild command.
Starting and Stopping Sail
Start all containers defined incompose.yaml with the up command.
stop command or press Ctrl + C if running in the foreground.
Startup Flow
Executing Commands
When using Sail, your application runs inside a Docker container isolated from your local machine. Usesail as the prefix for all PHP, Artisan, Composer, and Node / NPM commands.
The Laravel documentation often shows commands like
php artisan, composer, and npm.
When using Sail, prefix them with sail so they run inside the container.PHP Commands
Composer Commands
Artisan Commands
Node / NPM Commands
Container Shell
Open a Bash session directly inside the application container.Services
The services below are available when runningsail:install or sail:add.
MySQL
Included by default incompose.yaml. Data is persisted in a Docker Volume.
On first startup, Sail creates two databases: one for development and a dedicated testing database.
Set DB_HOST=mysql in your .env file to connect from the application.
3306.
Redis
SetREDIS_HOST=redis in your .env file.
Valkey
Valkey is a Redis-compatible alternative. SetREDIS_HOST=valkey in your .env file.
Mailpit
Mailpit intercepts emails sent during local development and provides a web UI for preview.http://localhost:8025 while Sail is running.
Meilisearch / Typesense
Both integrate with Laravel Scout for full-text search.- Meilisearch: set
MEILISEARCH_HOST=http://meilisearch:7700 - Typesense: set
TYPESENSE_HOST=typesense,TYPESENSE_PORT=8108, etc.
RustFS (S3-compatible storage)
Use RustFS to emulate Amazon S3 locally without creating real S3 buckets.Running Tests
sail test is equivalent to sail artisan test. Sail creates a dedicated testing database so your tests never interfere with development data.
Laravel Dusk
Run Dusk browser tests without installing Selenium locally. Uncomment the Selenium service incompose.yaml.
PHP and Node Versions
Changing the PHP Version
Update thebuild.context for the laravel.test container in compose.yaml.
Changing the Node Version
Updatebuild.args in compose.yaml.
Sharing Your Site
Share your local site publicly for colleague previews or webhook testing.laravel-sail.site URL is generated. Configure trusted proxies in bootstrap/app.php to ensure URL helpers work correctly.
--subdomain option.
Debugging With Xdebug
Enable Xdebug
Publish the Sail configuration first, then add the following to your.env file.
php.ini contains the following configuration.
CLI Debugging
Browser Debugging
Follow the instructions from Xdebug to start a debug session from your browser. PhpStorm users should refer to JetBrains’ zero-configuration debugging guide.Customization
Publish Sail’s Dockerfiles and configuration files to customize your environment.docker/ directory at your application root.
After making changes, rebuild your containers.
Sail vs. Production
| Aspect | Sail (local) | Production |
|---|---|---|
| Purpose | Development and debugging | Serving users |
| Xdebug | Can be enabled | Should be disabled |
| Mailpit | Captures emails for preview | Real mail server |
| Data persistence | Docker Volume | Managed database service |
| Performance | Not optimized | Optimization required |