codezero/composer-preload-files
codezero/composer-preload-files is a Composer plugin that generates and manages PHP preload file lists, helping Laravel and PHP applications warm OPcache at startup for faster boot and response times.
Architecture fit. This is not a Laravel package in the conventional sense — it is a Composer plugin that hooks the autoload-dump lifecycle to inject a set of project-specified files ahead of Composer's generated vendor/composer/autoload_files.php chain. Architecturally it sits at the very bottom of the stack: it changes what executes when vendor/autoload.php is required, which for a Laravel app is the first statement in public/index.php, artisan, and bootstrap/app.php's require path. That makes it a build-time concern with runtime ordering consequences, and it is framework-agnostic — Laravel compatibility is incidental, not designed-in.
Integration feasibility. Mechanically simple: composer require codezero/composer-preload-files, add the file list under extra, run composer dump-autoload. The real friction is Composer 2.2+'s allow-plugins gate, which requires an explicit opt-in entry in composer.json and will otherwise block install in CI and on fresh clones. For the narrow use cases it targets — constants or polyfills that vendor code references at file-inclusion time, function shims, environment guards that must precede framework bootstrap — it is the only clean hook short of a custom bootstrap file. Outside those cases it is unnecessary.
Technical risk. High, driven almost entirely by project health rather than code complexity. Three stars, zero dependents, a single release in May 2023, and a composite score of 0.045 indicate an effectively unmaintained artifact. A Composer plugin is coupled to the composer-plugin-api contract and to Composer's internal autoload generation events; major Composer releases have historically changed both. There is no evidence the plugin has been validated against PHP 8.3/8.4 or Composer 2.7+. The codebase is presumably small enough to audit in an afternoon — which is both the mitigation and the argument for inlining it.
Key questions.
composer-plugin-api versions are declared, and is Composer 2.x the only supported line?autoload_files.php in place or emit a separate preload file consumed by a generated bootstrap? The former risks being clobbered on the next dump.--optimize-autoloader, --classmap-authoritative, and --no-dev?composer install on different machines, or dependent on filesystem iteration?Stack fit. Compatible with any Composer-driven PHP project, Laravel 9–11 included, but it solves a problem most applications do not have. It earns its place only where inclusion order genuinely matters and cannot be solved by a root-level autoload.files entry, a bootstrap/app.php preamble, or restructuring the offending vendor dependency. Treat it as a last-resort escape hatch, not a general-purpose autoload enhancement.
Migration path. Low-effort and fully reversible. Add the package to require, add "codezero/composer-preload-files": true to config.allow-plugins, declare the file list in extra, then composer dump-autoload and verify vendor/composer/ output. Rollback is a composer remove plus a dump — no data migration, no runtime state. Because the change is confined to autoload generation, it can be trialed on a single branch and validated by one CI run.
Compatibility. Three axes to pin and test: PHP minor version, Composer major/minor, and Laravel version (specifically the shape of the bootstrap sequence). Since the plugin is unmaintained, pin it to an exact version in composer.json and record the PHP/Composer matrix it was validated against. Also verify behavior in production installs using --no-dev --optimize-autoloader, which is where ordering differences most often surface.
Sequencing.
allow-plugins in composer.json and in CI configuration before adding the dependency, to avoid a broken pipeline.vendor/composer/.--no-dev build.Maintenance. The dominant cost. A single-maintainer, single-release, zero-dependent plugin is a supply-chain and bus-factor liability. Budget for either (a) pinning permanently and accepting no upstream fixes, or (b) forking the few hundred lines into the repo or an internal Composer plugin. Given the plugin's small surface, option (b) is likely cheaper within two years and removes the allow-plugins negotiation from every new developer's setup.
Support. Effectively none. Documentation is a README; there is no issue-tracker velocity to rely on. Internal ownership must be assigned, and the failure mode must be diagnosable by the team without upstream help — which argues for familiarity with Composer's autoload generation internals.
Scaling. Negligible runtime impact: file inclusion is O(files) at boot, dwarfed by framework bootstrap, and there is no per-request overhead beyond what the included files themselves cost. The scaling concern is organizational, not performance — every service that adopts it inherits the same unmaintained dependency and the same ordering fragility.
Failure modes.
allow-plugins is unset, producing correct-looking installs where the preload files never load. Failure appears at runtime, far from the cause.dump-autoload without the plugin active reverts behavior unpredictably.files entry can shift relative order in ways that only manifest in production.Ramp-up. Conceptually steep for the payoff — engineers must understand Composer's files autoload semantics, the plugin API, and the Laravel bootstrap sequence to use it safely. Setup itself is under an hour. The correct organizational stance is to treat this as a specialized tool with a named owner and a documented rationale, or to skip it entirely in favor of inlining the behavior.
How can I help you explore Laravel packages today?