LinuxCommandLibrary

larasail

Quickly build and manage Laravel applications

TLDR

Set up the server with Laravel dependencies using the default PHP version

$ larasail setup
copy

Set up the server with Laravel dependencies using a specific PHP version
$ larasail setup [php71]
copy

Add a new Laravel site
$ larasail host [domain] [path/to/site_directory]
copy

Retrieve the Larasail user password
$ larasail pass
copy

Retrieve the Larasail MySQL password
$ larasail mysqlpass
copy

SYNOPSIS

larasail [options] [command] [--] [arguments...]

PARAMETERS

-d, --detach
    Detach containers during manual startup

--docs
    Display Sail documentation

-h, --help
    Display this help message

--quiet
    Do not output any message

-V, --version
    Display the Sail version

--ansi | --no-ansi
    Force (or disable) ANSI output

-v | -vv | -vvv, --verbose
    Increase verbosity of messages (1=normal, 2=verbose, 3=debug)

DESCRIPTION

LaraSail is a lightweight command-line tool integrated with Laravel for managing Docker-powered development environments. It simplifies spinning up a full-stack setup including PHP-FPM, Nginx/Apache, MySQL/PostgreSQL/SQLite, Redis, Memcached, Mailpit, Selenium, and more, without deep Docker knowledge.

Using larasail, developers can execute Laravel Artisan commands, run Composer or NPM installs, perform tests with PHPUnit or Dusk, access database shells (mysql/redis), view logs, build images, and prune resources effortlessly—all proxied through Docker containers. It ensures consistent environments across team members and OSes (Linux, macOS, Windows).

Installation involves adding it via Composer, copying environment files, and running larasail install with optional service flags (e.g., --with-redis --with-memcached). Services are defined in docker-compose.yml, customizable for specific needs. LaraSail supports PHP 8.1+, multiple databases, and hot-reloading for assets.

Ideal for local dev, it avoids production complexities while offering production-like isolation. Commands like larasail up -d start detached services, larasail shell drops into app container, and larasail down --volumes cleans up data.

CAVEATS

Requires Docker and Docker Compose 1.27+. Run from Laravel root directory with Sail installed via Composer. Development-only; not for production. Port 80/443/3000 may conflict.

INSTALLATION

composer require laravel/sail --dev
Copy .env.example to .env
larasail install [with-mysql|pgsql|redis|...]
larasail up

COMMON COMMANDS

larasail up [-d] - Start services
larasail down [-v] - Stop/remove containers [and volumes]
larasail artisan migrate - Run migrations
larasail test - Run tests
larasail shell - App container shell

HISTORY

Introduced with Laravel 8.0 in September 2020 by Taylor Otwell. Evolved from community tools like Laradock; now official, with updates in Laravel 9/10/11 for PHP 8.x, Pest testing, and service expansions.

SEE ALSO

Copied to clipboard