mcaskill/composer-exclude-files
Composer plugin that lets you exclude specific files from autoloading. Declare exclusions in composer.json to keep classmaps lean and stop unwanted files autoload entries from loading—handy for test fixtures, stubs, and optional integrations. Simple configuration, no code changes required.
autoload_files.php is required on every request. This package lets you drop specific eagerly-loaded files without forking the dependency, so it directly supports decisions like "is shaving N file includes per request worth an engineering afternoon?" — usually yes on high-traffic endpoints, rarely on admin-only surfaces.files autoload that conflicts with ours, defines functions we already have, or pulls in side effects at boot, the usual menu is: fork it, replace it, patch it after install, or exclude the file. This package makes "exclude the file" a first-class, declarative option — a cheaper build-vs-buy answer than maintaining a fork.autoload.files, and is that file essential at boot? Roadmap implication: standardize lazy-loading for helper files in our own first-party packages so we never need the workaround.Consider it when:
strace/opcache analysis shows measurable per-request cost from autoload_files.php, or a specific included file is genuinely unused in your code paths.composer.json rather than a post-install script that mutates vendor/ (which is invisible to code review and breaks on composer install ordering).allow-plugins under control and you pin versions in composer.lock.Look elsewhere when:
autoload.files declaration upstream and delete the workaround; permanent fixes beat permanent exclusions.replace, a fork, or simply don't install it. This plugin is a scalpel, not a dependency remover.allow-plugins is centrally pinned and adding entries is a slow approval path — the coordination cost may exceed the benefit.Adoption caveats to weigh: ~40 stars and zero dependents means effectively no production track record — you are an early adopter. Single-maintainer bus factor, and the plugin sits in the critical path of composer install, so a break blocks every build. Counterweight: MIT license, tiny surface area, and a recent release date suggest it's maintained. Mitigation: pin exactly, commit the lockfile, document each exclusion with a reason and a removal trigger, and keep a fallback (--no-plugins plus manual patch) in the runbook.
For executives (30 seconds): Every PHP request to our Laravel apps loads a pile of helper files that third-party packages force in at boot — even when our code never uses them. This is a small, MIT-licensed Composer plugin that lets us opt out of specific files with one line of config, no forking and no patching. It's a low-cost lever on page latency and infrastructure cost, and it reduces how much unfamiliar code runs on every single request. The trade-off is that it's a young project with no visible adopters, so we'd pin it, document every exclusion, and treat it as a temporary measure with a cleanup date — not a permanent architectural commitment.
For engineering leads: It solves a real, annoying problem — removing a vendor's autoload.files entry without vendoring the package — and it does so declaratively in composer.json, which means the decision is code-reviewed and versioned instead of hidden in a post-install script. Costs: it's a Composer plugin (needs allow-plugins approval), it lives in the install critical path, and it's an escape hatch that can mask upstream bugs. Recommendation: pilot on one service where we have profile data, measure the delta, gate adoption on a written exclusion rationale per file, and require an upstream fix or removal within two quarters. Don't standardize org-wide on the strength of 40 stars.
How can I help you explore Laravel packages today?