-
-
Save chistel/ae025f0b1651d1dd53b645dbfc33e085 to your computer and use it in GitHub Desktop.
Install Laravel Sail into an existing project without PHP & Composer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Installs Laravel Sail into an existing project | |
# The official Laravel Sail docs[1] provide instructions for installing Sail | |
# into an existing PHP application. But the official method requires invoking | |
# Composer locally. Part of Sail's appeal is that it removes the need to | |
# install PHP on your host machine. | |
# This script is lifted from laravel.build[2], and thus uses the same method | |
# to bootstrap Sail into your app--namely, it creates a disposable Docker | |
# container, then within that container it installs all Composer | |
# dependencies, adds Laravel Sail to the list of dev dependencies, and | |
# invokes Sail's artisan command to publish the default docker-compose.yml. | |
# [1](https://laravel.com/docs/8.x/sail#installing-sail-into-existing-applications) | |
# [2](https://laravel.build/example-app) | |
docker run --rm \ | |
-v $(pwd):/opt \ | |
-w /opt laravelsail/php80-composer:latest \ | |
bash -c "composer require --dev laravel/sail && composer install && php artisan sail:install --with=mariadb,mailhog,redis" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment