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

Laminas Config Aggregator Laravel Package

laminas/laminas-config-aggregator

A Laminas package that aggregates configuration from multiple sources—PHP files, arrays, and modules—into a single merged config, with support for caching, glob patterns, and post-processing hooks for use in Laminas and Mezzio applications.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. laminas-config-aggregator is a framework-agnostic, single-purpose library: you construct ConfigAggregator with an ordered list of providers, optionally a list of post-processors and a cache path, and call getMergedConfig(). Merging is shallow-by-key with later providers winning; recursion is not deep-merged across nested arrays. Providers are pluggable (PhpFileProvider for *.php returning arrays, LaminasConfigProvider for YAML/JSON/XML/INI via laminas-config), and post-processors are plain callables or invokable classes that transform the merged array (e.g. parameter/placeholder resolution à la Symfony ParameterBag).

It has no coupling to Laravel — no service provider, no facade, no Illuminate\Config\Repository awareness. That cuts both ways: it drops in cleanly, but it is not an extension of Laravel's config system, it is a competing one. Architecturally it fits Laravel as an alternate composition layer that feeds config(), not as a replacement for the repository contract.

Where it genuinely fits a Laravel stack:

  • Multi-format config (YAML/JSON/INI/XML) — Laravel natively supports only PHP arrays plus .env. If product/ops wants YAML config authored by non-PHP teams, this is the shortest path.
  • Ordered composition of many small fragments — modular monoliths, plugin/extension registries, or a monorepo where each package ships config/*.global.php and a deterministic precedence order matters.
  • Cross-framework config parity — one config package consumed by both a Laravel app and a Mezzio/Laminas service, giving identical merge semantics in both.
  • Post-processing / parameter resolution — templated values like %database.host% resolved after merge, without hand-rolling it.

Where it does not fit. ~80% of a typical Laravel app's config needs are already served by config/*.php + php artisan config:cache. Introducing a second aggregation stage for a standard app buys complexity and a second precedence model for near-zero gain.

Integration feasibility. High. Composer install, one class, no bootstrapping ceremony. The only real work is an adapter: a ConfigAggregatorServiceProvider that runs the aggregator once and writes the result into the container/Config\Repository, plus reconciliation with config:cache. Effort is measured in days, not weeks.

Technical risk. Low at the code level, moderate at the ecosystem level:

  • Small surface area, BSD-3-Clause, disciplined semver, PHP 8.4/8.5 support as of 1.19.0 (PHP 8.1 dropped — verify this doesn't strand any service on an older runtime).
  • 43 stars and 0 tracked dependents is the headline risk: no social proof, no independent production evidence. Maintenance is a small Laminas volunteer group with heavy Renovate automation — releases are frequent but thin (most are dependency/QA bumps, single contributor each).
  • Classes are annotated soft @final (since 1.18.0): treat as non-extensible; compose, don't subclass.
  • Cache-file generation writes an exported PHP file with a configurable CACHE_FILEMODE (octal, e.g. 0600) — a permissions/ops concern that must be owned.
  • PhpFileProvider globbing depends on laminas-stdlib's glob compatibility layer (historically fragile on FreeBSD/IBM i) — irrelevant on standard Linux containers, relevant if you have exotic build hosts.

Key questions to resolve before commitment:

  1. What concrete requirement does Laravel's native config not satisfy — multi-format authorship, cross-framework parity, post-processing, or fragment ordering? If the answer is "none," stop.
  2. Is the team prepared to own a second precedence model in the same application, and document it?
  3. Who owns cache invalidation and file permissions across deploy targets?
  4. Is there a viable exit ramp — can we swap to a ~100-line in-house aggregator if the package stalls?
  5. Does the security/compliance review accept a low-adoption dependency in the config path (highest blast-radius position in the app)?

Integration Approach

Stack fit. Treat the aggregator as a build-time composer of config, not a runtime service. Recommended topology:

  • ConfigAggregator instantiated once at bootstrap (or in a dedicated config:aggregate artisan command), producing a single PHP array or cache file.
  • A thin service provider merges that array into Illuminate\Config\Repository via $app['config']->set(...), so application code keeps using config('...') unchanged. Developers never see the new library.
  • Never call getMergedConfig() from request-handling code paths — cache or memoize.

Migration path (incremental, reversible).

  1. Spike, 2–3 days: stand up the aggregator alongside existing config in a single non-critical Laravel app; validate precedence matches expectations on a copy of real config files. No production impact.
  2. Shadow mode: generate the aggregated array, diff it against Laravel's config:cache output in CI. Any drift is a bug in the migration, not in production. Exit here if the diff is not clean and boring.
  3. Adopt for a bounded domain: migrate one config namespace (e.g. a package registry or a plugin manifest set), not the whole config/ directory.
  4. Optional expansion to full config authorship only if step 3 demonstrates value.

Compatibility notes.

  • PHP: pin to a runtime satisfying both Laravel's floor and the aggregator's (currently 8.2+ on Laravel 11/12; aggregator supports 8.2–8.5 as of 1.19). Re-check at each Laravel major.
  • laminas-config is only required if you use LaminasConfigProvider (YAML/JSON/XML/INI); skip it for PHP-only.
  • brick/varexporter is a transitive concern for cache export — its version range has churned (^0.4 || ^0.5 || ^0.6); do not pin tightly.
  • No Laravel facades, no container coupling: safe to use in a package that must also run outside Laravel.

Sequencing.

  1. Confirm the unmet requirement and record the decision (ADR).
  2. Security/license review of the dependency tree (laminas-config-aggregator, laminas-stdlib, optionally laminas-config, brick/varexporter).
  3. Build the adapter provider + a config:aggregate command; wire into CI shadow diff.
  4. Reconcile the cache: choose one cache owner. Simplest is to disable the aggregator's file cache and let php artisan config:cache serialize the final array — one artifact, one invalidation story. Use the aggregator's cache only for non-Laravel consumers.
  5. Roll out behind a config flag with a documented rollback to native config.

Operational Impact

Maintenance. Low ongoing code maintenance — the library is small and stable, and releases are overwhelmingly automated dependency bumps. The real maintenance cost is team cognition: engineers must understand a precedence chain that isn't Laravel's. Budget for documentation and a "config lives here" rule enforced in onboarding. Version upgrades are predictable (semver, minor releases), but the annual PHP-support window shifts (8.0 dropped in 1.14, 8.1 in 1.19) — schedule the runtime upgrade review as a recurring task, not an incident.

Support. Primary support is upstream docs at docs.laminas.dev plus the Laminas GitHub issue tracker — no commercial backing, no SLA. With 0 tracked dependents and ~43 stars, expect to be close to the only ones in your niche; you are effectively self-supporting. Mitigate by keeping the integration surface to a single provider class (~100–150 LOC) so replacement is cheap.

Scaling. Negligible runtime cost: aggregation is array merges over a handful of files, and the cache path makes bootstrap a single include of an exported PHP array — opcache-friendly and faster than repeated glob+merge. Costs scale with number of config fragments and post-processors, not traffic. If you use providers that hit the filesystem with globs on every request, you have a design bug — always cache. Memory footprint of the merged array is the same order as Laravel's native config.

Failure modes to design against.

  • Precedence drift / silent overrides — shallow merge means a later provider's top-level key replaces an entire nested subtree. This is the single most likely production incident; mitigate with the CI shadow diff and a documented provider order.
  • Stale cache after deploy — a persisted aggregated cache file not invalidated alongside code changes serves previous-release config. Mitigate by rebuilding during the deploy (same hook as config:cache) and never shipping a cache file in the artifact.
  • Cache file permissions — incorrect CACHE_FILEMODE (e.g. world-readable 0644 for a file containing secrets) is a real security exposure. Default to 0600, and keep secrets in env/secret manager rather than in aggregated files.
  • Missing/invalid provider file — one malformed YAML/JSON fragment or an empty glob can fail bootstrap entirely; the failure is total app unavailability, not degraded behavior. Fail loudly in CI, and validate config shape at build time.
  • Abandonment risk — package archived or PHP support lags a required runtime. Mitigated by the thin adapter boundary and an in-house fallback.

Ramp-up. One to two engineer-days for a senior PHP developer to become productive; the API is a constructor plus one method. Ramp-up cost is concentrated in policy, not code: which sources exist, what order they run in, and where the cache is written. Write that down before writing any code.

TPM verdict. Adopt only against a named requirement (multi-format config, cross-framework parity, or fragment ordering), and only as a build-time composer feeding Laravel's native config repository. Do not adopt for a conventional Laravel application — Laravel's own config pipeline is more familiar, better supported, and cheaper to operate. Keep the integration to a single adapter class so that the dominant risk — a low-adoption dependency sitting in the highest-blast-radius position in the stack — remains a two-day swap rather than a migration.

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.
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle