Team Development With Laravel
Cross platform development doesn't have to be tough.

September 8, 2020 Laravel 8 was released.
October 23, 2020 Taylor Otwell asked the Windows Laravel community on Twitter, what virtual environment they were using to develop in. Wampp/Xampp was the winning option with 39.1% of people using it.
December 8, 2020 Taylor Otwell announced the launch of Laravel Sail. Now it is officially the recommended way to develop in Laravel.
There is documentation on how to install Laravel Sail into existing applications. For those who are creating new applications Sail is included in Laravel 8.*.
I have had no issues with Laravel Sail development in Linux, but recently I have had issues when a teammate is developing in Windows. So I will be outlining the procedure I used to overcome these issues.
The issue we kept running into was when launching the sail application. We would get the following error.
./usr/bin/env: 'bash\r': No such file or directory
Fixing this was a bit confusing because there was not a lot of people who had resolved the issue. However there was a suggestion in the Laravel documentation that helped me figure it out.
To start off, I downloaded Docker Desktop for Windows. When installing there was a checkbox for WSL2 installation. WSL2 is a Windows subsystem for Linux. So I made sure this was checked.
Then, I opened the terminal and entered the wsl command. From here I navigated to the user root directory with the cd ~ command.
After this I was ready to clone the repository with git.
git clone https://path-to-directory
My local repository was missing dependencies, so I installed them with this command from the Laravel documentation.
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php81-composer:latest \
composer install --ignore-platform-reqs
From here all I needed to do was create an .env file by copying the .env.example file, launch the application sail up, and set the application key in a new wsl tab sail artisan key:generate.
