Don't run "| bash" to only download the script
and modify it as you want following this link
https://stackoverflow.com/questions/71212177/set-laravel-version-using-sail
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In the docs, I can see we can install Laravel with Sail using the following:
curl -s "https://laravel.build/example-app?with=mysql,redis" | bash
But is there not a way where we can specify which versionof Laravel to install and also which version of PHP to use with this command?
I am trying to avoid installing composer/npm/etc on my computer and let docker handle all that.
Don't run "| bash" to only download the script
and modify it as you want following this link
https://stackoverflow.com/questions/71212177/set-laravel-version-using-sail
Excellent, thank you so much! This got me on the right track but I think my last obstacle has became a dead end.
I thought I could change the sail 8.1 to 7.3 but... From the docs: "When using the laravelsail/phpXX-composer image, you should use the same version of PHP that you plan to use for your application (74, 80, or 81)."
It does not look like I can go as far back as php 73 using this method :(
@J-LXXXIX
Php 7.3 is end of life https://www.php.net/supported-versions.php
You should consider upgrade it.
@sr57 Yeah I know. Just trying to match certain enviornment conditions given to me. Appreciate the help! :)
@J-LXXXIX
Never did it but may be you can have a look to this
Check my install example here. It let's you specify laravel version
https://sinnbeck.dev/posts/using-lando-to-run-laravel-in-docker
You can remove the last line if you don't use lando. You can add a sail install command in there if you want
SITENAME=my-app; docker run --rm --interactive --tty \
--volume $PWD:/app \
--user $(id -u):$(id -g) \
composer create-project laravel/laravel $SITENAME ^9.0 \
&& cd $SITENAME \
&& lando init --source cwd --webroot ./public --recipe laravel --name $SITENAME
Another trick would be to download the file instead of running it. Then edit it to your liking, and then run it
You can just open it in your browser to see the contents https://laravel.build/example-app?with=mysql,redis
I could be wrong but my understanding is Sail is not available for any PHP versions under 7.4
Here is the script I ran which got me so close, yet so far: Note: I had an issue where composer 1 was being used, and memory issues but the following script fixes those issues and makes "l8-app" not "example-app"
docker info > /dev/null 2>&1
# Ensure that Docker is running...
if [ $? -ne 0 ]; then
echo "Docker is not running."
exit 1
fi
docker run --rm \
-v "$(pwd)":/opt \
-w /opt \
laravelsail/php73-composer:latest \
bash -c "COMPOSER_MEMORY_LIMIT=-1 && composer self-update && composer create-project laravel/laravel l8-app 8.0 && cd l8-app && composer require laravel/sail && php ./artisan sail:install --with=mysql "
cd l8-app
CYAN='3[0;36m'
LIGHT_CYAN='3[1;36m'
WHITE='3[1;37m'
NC='3[0m'
echo ""
if sudo -n true 2>/dev/null; then
sudo chown -R $USER: .
echo -e "${WHITE}Get started with:${NC} cd l8-app && ./vendor/bin/sail up"
else
echo -e "${WHITE}Please provide your password so we can make some final adjustments to your application's permissions.${NC}"
echo ""
sudo chown -R $USER: .
echo ""
echo -e "${WHITE}Thank you! We hope you build something incredible. Dive in with:${NC} cd l8-app && ./vendor/bin/sail up"
fi
@sinnbeck Thank you for responding. I am afraid I have not heard of Lando, but once I get a chance I will look more in detail on what you have sent.
Much appreciated.
@J-LXXXIX Lando supports any version I think. I have tested it on 5.6, 7.4 or and 8.0. All worked as expected.
Not sure about sail as I dont use it. But you can try getting the binary and run it directly. It is just a shell script https://github.com/laravel/sail/blob/1.x/bin/sail
EDIT: JUst checked and the laravel part indeed requires php 7.3+ https://github.com/laravel/sail/blob/1.x/composer.json#L17
@Sinnbeck This is excellent information, thank you for this. Apologies, life is getting in the way for me to really dive into this at the moment. But from what I am seeing this is giving me hope again! XD
@J-LXXXIX life should always come first. No worries. The guide will still be there when you are ready. If you run into issues, I also help out on the Lando slack chat
Please or to participate in this conversation.