Composer Ignore Plugin
This plugin help us to remove the unused file or directories in vendor., (*1)
Installation
Both global or local install can work well., (*2)
1.Install globally, so every project can use the plugin., (*3)
$ composer global require "light/composer-ignore-plugin:~2.0"
2.Install locally, (*4)
$ composer require "light/composer-ignore-plugin:~2.0" --dev
Usage
Define the ignore file or directory in composer.json, for example:, (*5)
Before:, (*6)
fzaninotto/faker/
โโโ CHANGELOG.md
โโโ composer.json
โโโ CONTRIBUTING.md
โโโ LICENSE
โโโ Makefile
โโโ phpunit.xml.dist
โโโ readme.md
โโโ src
โโโ test
Configuration in composer.json
:, (*7)
{
"extra": {
"light-ignore-plugin": {
"fzaninotto/faker": [
"test",
"*.md",
"LICENSE",
"Makefile",
"phpunit.xml.dist"
]
}
}
}
After executed composer install
, composer update
, composer dump-autoload
, The files will be removed., (*8)
When execute the composer install
or composer update
will finally trigger the autoload dump event, (*9)
After:, (*10)
fzaninotto/faker/
โโโ composer.json
โโโ src
Why this?
Thanks to open source, there are many useful packages helped us., (*11)
Generally, some files or folder in the installed package is useless, and when deploy to production system, reduce the files can make deploy clean., (*12)
Of cause, a lot of package had done this by add .gitattributes
file, But also not all, fzaninotto/faker
for example., (*13)
LICENSE
MIT, (*14)