Laravel Sail

News

December 9th, 2020

laravel-sail-featured.jpg

Taylor Otwell released Laravel Sail this week—a lightweight CLI for interacting with Laravel’s default docker environment. It provides a simple interface the helps you get started on your next big idea in no time. This new development environment option is now documented in the installation guide.

The fasted way to get started with Sail is running the following command (referenced from the installation docs) after you have Docker installed:

1curl -s https://laravel.build/my-inspiring-app | bash

New installations of Laravel will automatically include a vendor/bin/sail CLI script you can use to start, stop, and manage your Laravel application in an easy-to-use Docker environment. Here are a few example commands for managing your development environment with Sail:

1alias sail='bash vendor/bin/sail'
2 
3# Run docker containers `docker-compose up`
4sail up
5# Run docker containers in the background
6# `docker-compose up -d`
7sail up -d
8 
9# Stop containers and remove containers, networks, etc.
10sail down

Sail comes with NPM, composer, and all the tools you’re used to using locally, all packaged up neatly inside Docker containers. Here are some examples you’d typically use:

1# Runs php artisan queue:work in the container
2sail artisan queue:work
3 
4# Run PHP CLI commands and return output
5sail php --version
6 
7# Require a composer package
8sail composer require laravel/sanctum
9 
10# Node and NPM
11sail node --version
12sail npm install

To get started, check out the official Laravel Sail documentation!

Taylor also did a live stream demonstrating Laravel Sail and gives some background on the project:

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.