Question

Running composer install in a Symfony Standard Edition application with a requirement for Doctrine will add a folder called 'bin'. The folder is configured in composer.json:

"config": {
    "bin-dir": "bin"
}

The .gitignore file that comes with the Symfony Standard Edition includes the directory (causing git to ignore the directory and all it's contents). It seems like the 'bin' folder only contains links to files inside the 'vendor' folder. This leads me to think that it's a good idea to ignore the folder and let Composer handle it.

However, the example .gitignores from GitHub and in Symfony's docs doesn't include 'bin'. In fact, I can't really find much about this directory in the official Symfony docs at all, including whether or not it's recommended to keep it out of version control.

Is it indeed recommended to let git ignore this directory and its contents, and is Symfony's documentation simply not up-to-date?

Was it helpful?

Solution

Symfony 3 and later

In the Symfony 3 Standard Edition, the purpose of the bin directory has been slightly changed. Binaries from Composer packages (such as phpunit) are no longer installed in the bin directory, but in vendor/bin. Instead, the bin directory contains the console and optionally some other binaries that come with the Symfony skeleton.

Because these files should be committed to your Git repository, you should no longer have the bin directory in your .gitignore file.

OTHER TIPS

EDIT: This is answer is only applicable to Symfony 2. For Symfony 3 and later see Nic Wortels answer below.

Is it indeed recommended to let git ignore this directory and it's contents, and is Symfony's documentation simply not up-to-date?

This is indeed the case. The bin directory is the same as the vendor directory, it depends on your requirements. It should be ignored. Except if you are going to put custom files in it (e.g. you move app/console to bin/symfony), then it should be ignored except from those custom files.

The Symfony2.gitignore file from GitHub had it's last update 2 years ago. In those 2 years, a lot of things happend (like using Composer with Symfony2). I wouldn't recommend using it as an example.

The docs were indeed not up-to-date, if you hit the "edit" button in the docs you can update it yourself. I'll be very happy if you do that! :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top