bamarni/composer-bin-plugin
Composer plugin to isolate “bin” tool dependencies (PHPStan, Rector, PHPUnit, etc.) in separate Composer environments to avoid version conflicts and dependency pollution. Provides config for bin links, target directory, and command forwarding.
Start by installing the plugin as a dev dependency in your main project:
composer require --dev bamarni/composer-bin-plugin
This adds the bin command to Composer. The first use case is isolating CLI tools with conflicting dependencies (e.g., PHP-CS-Fixer and Rector both using nikic/php-parser). Create an isolated environment for each tool:
composer bin php-cs-fixer require --dev friendsofphp/php-cs-fixer
This creates vendor-bin/php-cs-fixer/composer.json, installs dependencies there, and avoids polluting your main composer.json dependencies.
php-cs-fixer, phpstan, rector, etc.) to keep their dependencies isolated.bin all for bulk operations: Use composer bin all update or composer bin all require to apply commands across all namespaces.forward-command in config ("bamarni-bin": { "forward-command": true }) to auto-run composer install/update in all vendor-bin/* directories during main composer install/update.{
"scripts": {
"cs-fixer": "php vendor-bin/php-cs-fixer/vendor/friendsofphp/php-cs-fixer/bin/php-cs-fixer"
}
}
vendor/bin/ won’t be auto-created. Use scripts or aliases instead.vendor-bin/*/vendor/ to prevent committing tool dependencies:
vendor-bin/**/vendor/
vendor-bin/*/composer.lock as binary in .gitattributes to avoid noisy diffs:
vendor-bin/**/composer.lock binary
working-directory (since ramsey/composer-install doesn’t support bin all natively)."bin-links": false and "forward-command": false initially, then opt-in to avoid surprises.How can I help you explore Laravel packages today?