4

I'm learning Laravel 8, and I want to set up a quick dev environment using Laravel Sail.

Since we usually don't commit to the vendor directory in Git, how can we run Sail from a fresh Git clone? We can't use "composer install" without it. Does it mean we should commit the vendor/bin and vendor/composer folders? What are the common practices about it?

Should we commit /vendor/bin to git for a fresh dev environment out of the box?

Karl Hill
  • 12,937
  • 5
  • 58
  • 95
bwarff
  • 365
  • 3
  • 16

1 Answers1

12

I have stumbled across the exact same problem. In the documentation there is the following section solving that:

You may install the application's dependencies by navigating to the application's directory and executing the following command. This command uses a small Docker container containing PHP and Composer to install the application's dependencies:

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

https://laravel.com/docs/8.x/sail#installing-composer-dependencies-for-existing-projects

Of course you also have to prepare the .env-File and other not commited dependencies.

malte.h
  • 135
  • 1
  • 5
  • Could you please explain what exactly do I have to prepare? I tried to run this command but it gives error. There's no information about it anywhere. Thank you in advance – Innit2 Sep 07 '21 at 17:04
  • If you use docker, you can run the docker run command mentioned above (from the doc link) to have composer in your virtual machine. Then you can : "composer require laravel/sail --dev" "php artisan sail:install" "./vendor/bin/sail up" And then you sail is available – bwarff Jan 06 '22 at 13:06
  • I got error too when execute in powershell – vannak May 02 '22 at 05:45