F_Z_14 F_Z_14 - 2 years ago 133
PHP Question

Why Composer install .git or .hg directories with package files?

I'm trying to publish composer package. I saved composer.json in my package directory:

"name": "vendor_name/my_bundle",
"type": "symfony-bundle",
"autoload": {
"psr-0": {
"VendorName\\MyBundle": ""
"target-dir": "VendorName/MyBundle"

But when I install it (composer update), with package files will added .hg directory.

Similar behavior can be seen in this package: https://packagist.org/packages/tom32i/file-bundle (with package files will added .git directory: http://joxi.ru/uploads/prod/20130201/560/53a/136c5290b3c0f4c6f6318445f358d1d8cf30fe13.png)


Answer Source

Quote from the documentation:

There are two ways of downloading a package: source and dist. For stable versions composer will use the dist by default. The source is a version control repository.

The package you mentioned has no stable version, so composer downloads the source from git. Use --prefer-dist if you'd like composer to download package files (only happens if possible).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download