This shell script can be used to quickly setup a new Laravel project with Sail. It is assumed you have Docker installed with the WSL option enabled.
- Open a WSL shell
git clone git@github.com:nsanden/laravel-sail-new-project.git
cd lararavel-sail-new-project
chmod +x startproject.sh
./startproject.sh project-name
(where project-name is lowercase with dashes instead of spaces)
This will
- create a directory in the current directory called
project-name
- create a new Laravel project inside this directory and install Sail
- create the docker-compose.yml file with an additional setting to add PHPMyAdmin
- add sail to bashrc if needed
Once the sript finishes, just cd into the new directory and then:
sail up -d
sail npm install
sail npm run dev
sail php artisan migrate
- Visit http://localhost