larasail
Quickly build and manage Laravel applications
TLDR
Set up the server with Laravel dependencies using the default PHP version
Set up the server with Laravel dependencies using a specific PHP version
Add a new Laravel site
Retrieve the Larasail user password
Retrieve the Larasail MySQL password
SYNOPSIS
larasail command [arguments...]
(Note: larasail is a proxy; it forwards commands and arguments directly to vendor/bin/sail.)
PARAMETERS
<sail_command>
Any valid Laravel Sail command to be executed within the Docker environment. Common examples include:
up: Bring up the application's Docker containers.
down: Stop and remove the application's Docker containers.
artisan [command]: Execute a Laravel Artisan command.
composer [command]: Execute a Composer command.
npm [command]: Execute an npm command.
php [command]: Execute a PHP command or script.
test: Run application tests.
ps: List running Docker containers for the application.
shell: Start a shell session inside the application container.
[
Any options or flags supported by the specific Laravel Sail command (e.g., `-d` for detached mode with `up`, `--help` for command-specific help, `--user=root` for `shell` or `exec`). These are passed directly to `sail`.
[
Any additional arguments required by the specified Laravel Sail command or the underlying command it executes (e.g., `migrate --seed` for `artisan`, `install --no-dev` for `composer`). These are passed directly to `sail`.
DESCRIPTION
larasail is a community-driven convenience wrapper script designed to streamline interactions with Laravel Sail, the official Docker development environment for Laravel applications. It primarily acts as an alias or shortcut for the `vendor/bin/sail` executable within a Laravel project. By placing `larasail` in your system's PATH (e.g., `~/.local/bin`), developers can significantly reduce typing by replacing verbose commands like `php vendor/bin/sail artisan migrate` with a much shorter and more convenient `larasail artisan migrate`.
The core benefit of `larasail` is improving the developer experience by making Sail commands feel more like native CLI commands, similar to artisan or composer. It transparently forwards all arguments and options directly to the underlying `sail` command, ensuring full compatibility with all of Sail's functionalities. This abstraction simplifies command execution, making local Laravel development with Docker more fluid and less cumbersome.
CAVEATS
larasail relies entirely on Laravel Sail and Docker. Therefore:
1. Docker must be installed, running, and accessible on your system.
2. You must be executing larasail within a Laravel project directory that has been properly configured for Laravel Sail (meaning the `vendor/bin/sail` executable must exist in the project's `vendor/bin` directory).
3. If `vendor/bin/sail` is not found, larasail will fail.
4. The larasail script itself needs to be placed in a directory included in your system's PATH environment variable for convenient system-wide access.
<I>INSTALLATION & TYPICAL USAGE</I>
larasail is typically installed by manually downloading a simple shell script and making it executable in a directory included in your system's PATH (e.g., `~/.local/bin`).
A common installation procedure involves:
1. Downloading the script: `curl -s
2. Making it executable: `chmod +x ~/.local/bin/larasail`
3. Ensuring ~/.local/bin is in PATH: Add `export PATH="$HOME/.local/bin:$PATH"` to your shell's configuration file (e.g., `~/.bashrc`, `~/.zshrc`) and then source it (`source ~/.bashrc`).
Once installed, navigate to your Laravel project root and simply replace `php vendor/bin/sail` with `larasail`. For example:
- To bring up containers: `larasail up -d`
- To run migrations: `larasail artisan migrate`
- To open a shell: `larasail shell`
HISTORY
larasail is not an official component of the Laravel framework but rather a popular community-driven utility. Its genesis lies in the desire among developers to simplify the repetitive `php vendor/bin/sail` prefix required for every Laravel Sail command. As Laravel Sail became the de facto standard for local Laravel development, the need for a more concise command-line interface became evident. Consequently, various community members created and shared simple shell scripts or aliases, often referred to generically as 'larasail,' to abstract away the verbose prefix. This distributed and informal development reflects a common pattern in open-source communities where user-driven convenience tools emerge to enhance official offerings.