Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

treadnought's avatar

Installing Sail Into Existing Applications

Following the instructions in the docs to install sail into a laravel application skeleton cloned from github.

In the cloned directory I issue the command

docker run --rm \
-u "$(id -u):$(id -g)" \
-v "$(pwd):/var/www/html" \
-w /var/www/html \
laravelsail/php82-composer:latest \
composer install --ignore-platform-reqs

as instructed under Installing Composer Dependencies For Existing Applications.

Then back up the page to the section Installing Sail Into Existing Applications, tried composer require laravel/sail --dev which of course just gets Command 'composer' not found.

So it's necessary to run the docker run command again with the last line changed to composer require laravel/sail --dev (and same for php artisan sail:install).

The docs seem to be wrong here - or is it me?

0 likes
6 replies
s4muel's avatar

first person to install the sail to an existing laravel app needs a working local composer. (since the app already exists, every one who develops the app should have that).

from that point on, a new developer is not required to have composer nor php, so he must install the dependencies using the provided docker command (that uses a laravelsail/php82-composer container containing both composer and php).

treadnought's avatar

I cloned a "skeleton" project (tenancy-for-laravel/saas-boilerplate) from git. It was not developed using Docker so there's no docker-compose.yml.

Yes, I can install the dependencies in its composer.json using the "small docker container" run command, but that won't include Sail.

So if I then go back up the page and follow the documentation as written, I will just get a "composer not found" because I need to be running Sail to use composer. I need to edit the first "small docker container" command to install Sail and get it running.

I've read Mr Otwell saying that Sail is aimed at people without Docker knowledge - but it's only possible to install Sail into a cloned project if I do know Docker well enough to understand the command.

My question was: does the documentation need to be fixed?

treadnought's avatar

Well the whole idea of Docker is to be able to avoid worrying about local installation of everything, and so far I've managed to avoid doing that. I'll look at a PR but this answers the current question thanks.

lombervid's avatar

You could try to install sail within the container. Something like this:

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/var/www/html" \
    -w /var/www/html \
    laravelsail/php82-composer:latest \
    composer install --ignore-platform-reqs \
	&& composer require laravel/sail --dev
lombervid's avatar

Oh, I just saw you talk about that in the fist post.

Yeah, I run into the same issue some time ago when I was trying to do something similar.

I ended up just modifying the script so I install sail from the container.

1 like

Please or to participate in this conversation.