pixelfear/composer-dist-plugin
Composer plugin that prefers installing packages from dist archives, speeding up installs and reducing VCS checkouts. Useful in CI/CD and production deployments where source clones aren’t needed, with configurable behavior per package or repository.
Install the package as a development dependency:
composer require --dev pixelfear/composer-dist-plugin
Add a dist section to your composer.json to define distributable sources:
{
"extra": {
"dist": {
"path/to/target/file.js": "https://example.com/path/to/source/file.js"
}
}
}
Run composer update (or install) — the plugin will fetch the remote asset and place it at path/to/target/file.js. No need to commit third-party binaries; they’ll be auto-downloaded on deployment.
Use for bundling static assets (e.g., JS/CSS, binaries, CLI tools) without including them in your repo. Ideal for internal package dependencies where release builds require pre-built assets but you want to avoid bloat in source control.
Common workflow:
dist targets in composer.json of your package’s root.post-autoload-dump or post-install-cmd scripts if you need to regenerate assets (e.g., after a new release tag).asset-packagist or npm/yarn for hybrid frontends — use this plugin only for non-NPM-available binaries or locked-down releases.Example: embedding a vendored CLI tool:
"extra": {
"dist": {
"bin/mytool": "https://github.com/org/mytool/releases/download/v1.2.3/mytool.phar"
}
}
--with-verification if available, or enforce strict URLs/versions manually to prevent supply-chain issues.latest or mutable tags.composer install runs with -o (optimize autoloader) if needed — the plugin doesn’t interfere with autoloading but avoids unnecessary rebuilds.How can I help you explore Laravel packages today?