Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Composer Preload Files Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

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.

  • Which composer-plugin-api versions are declared, and is Composer 2.x the only supported line?
  • Does it rewrite 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.
  • How does it behave under --optimize-autoloader, --classmap-authoritative, and --no-dev?
  • Is the ordering deterministic across composer install on different machines, or dependent on filesystem iteration?
  • Who owns the fork if the upstream maintainer disappears, and what is our tolerance for a pinned, unpatched build-time dependency?

Integration Approach

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.

  1. Confirm the requirement is real — reproduce the failure that necessitates pre-vendor loading.
  2. Audit the plugin source (small enough to review directly) and pin the version.
  3. Enable allow-plugins in composer.json and in CI configuration before adding the dependency, to avoid a broken pipeline.
  4. Add the package and file list on a feature branch; dump autoload and diff vendor/composer/.
  5. Validate across local, CI, staging, and a production-like --no-dev build.
  6. Decide explicitly between dependency and vendored fork; if the latter, document the divergence.

Operational Impact

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.

  • Silent plugin disablement: Composer skips the plugin when allow-plugins is unset, producing correct-looking installs where the preload files never load. Failure appears at runtime, far from the cause.
  • Autoload dump clobbering: if the plugin mutates generated files, a later dump-autoload without the plugin active reverts behavior unpredictably.
  • Composer upgrade breakage: a Composer major release invalidates the plugin API constraint, hard-failing installs — visible and recoverable, but a same-day blocker.
  • Ordering regressions: a new dependency adding its own files entry can shift relative order in ways that only manifest in production.
  • Debugging cost: autoload-order bugs present as "undefined constant" or "cannot redeclare function" during bootstrap, and the diagnostic path runs through generated vendor code most engineers never read.

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin