Search code examples
symfonygitignore

Should Symfony's 'bin' directory be ignored by git?


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?


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.