dg / composer-cleaner
🧹 Victor the Cleaner: a Composer plugin that removes tests, docs and everything else from vendor, keeping only the code that is autoloaded.
Requires
- php: >=7.1
- composer-plugin-api: ^1.0 || ^2.0
Requires (Dev)
- composer/composer: ^1.10 || ^2.0
- nette/tester: ^2.2
- phpstan/phpstan: ^0.12
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This tool removes unnecessary files and directories from Composer vendor directory.
The Cleaner leaves only directories containing the source files needed to use the libraries.
These are located according to the autoload section of composer.json in each installed library.
Conversely for example, tests are files that are not needed for use, so they are removed.
Installation
composer require dg/composer-cleaner
Then simply run composer update or composer require ... and the Cleaner automatically removes unnecessary files when new libraries are installed.
Configuration
Some libraries also requires other files/directories, which the the Cleaner judged to be unnecessary.
In this case, you can list them (specify paths to be ignored), in the configuration and the tool will keep them.
Or you can specify that some libraries should not be cleaned at all.
The Cleaner already knows a few such libraries (e.g. composer/ca-bundle and stripe/stripe-php) and keeps their files by itself.
Simply add a extra > cleaner-ignore section to composer.json file:
{ "extra": { "cleaner-ignore": { "slevomat/eet-client": [ // name of package "wsdl*", // list of files or subdirectories, you can use wildcards `*` and `?` "data/keep.crt" // a path with a slash keeps an item inside a subdirectory ], "mpdf/mpdf": true // ignores whole package } } }
Support Project
Do you like Victor The Cleaner? Are you looking forward to the new features?