- Is laminas/laminas-config-aggregator a Laravel package or a replacement for Laravel's config system?
- No. It is a framework-agnostic Laminas configuration merging library, not a Laravel package, and it does not replace Laravel's native config repository, config files, dotenv handling, or config:cache. Laravel already has a mature configuration subsystem, so treat the aggregator as a narrow tool for framework-independent packages or non-HTTP bootstrapping rather than a drop-in Laravel config layer.
- How do I install laminas/laminas-config-aggregator in a Laravel application?
- Install it with Composer as a normal dependency; no first-party Laravel service provider is included. If you need non-PHP formats, add laminas/laminas-config deliberately, and add laminas/laminas-stdlib for brace-style globbing. Then write a thin adapter or service provider that constructs ConfigAggregator and calls getMergedConfig() where your package or subsystem needs it.
- Can I use laminas-config-aggregator with Laravel's config() helper and config:cache?
- Not directly. The package returns a plain merged array and has no config() helper integration or config-cache bridge, so Laravel's ConfigRepository will not see it unless you write adapter code. If you adopt it, decide explicitly whether the aggregated array feeds a package-level consumer or is injected into Laravel config, and avoid running two config-cache lifecycles without clear ownership.
- What Laravel and PHP versions does laminas/laminas-config-aggregator support?
- The package is not Laravel-versioned; its compatibility is defined by its own PHP requirements and Laminas release metadata, not by Laravel's support matrix. Check the current composer.json and release notes for the exact PHP constraint before adopting it, and verify that constraint against your Laravel application's PHP runtime. Because it is framework-agnostic, Laravel version support is effectively whatever your adapter code supports.
- How does config precedence work when merging multiple providers?
- ConfigAggregator is constructed with an ordered list of callables and providers, and getMergedConfig() merges them into one array according to that order and the library's precedence rules. Later providers can override earlier values, so provider order is part of your configuration contract and should be explicit in code review. Pre- and post-processors can further modify the merged result, so test precedence rather than assuming it.
- How do I use glob patterns and PhpFileProvider in a Laravel package?
- PhpFileProvider can load PHP config files, and brace-style globbing requires the optional laminas/laminas-stdlib dependency. In a Laravel package, use it to collect default package config files from a config directory and merge them predictably before exposing the result through your own package API. Do not assume Laravel's config:cache will understand those globs or provider paths; keep the package's config assembly self-contained and tested.
- Can laminas-config-aggregator merge JSON, YAML, INI, or XML config files?
- Yes, but not through the core package alone. Multi-format parsing is provided by LaminasConfigProvider from the optional laminas/laminas-config dependency, which you must add deliberately. For a Laravel application, that is useful only when a package or CLI tool genuinely needs multi-format config; otherwise Laravel's native PHP config files are simpler and better supported.
- How should I test a Laravel integration with ConfigAggregator?
- Test the adapter, not just the library: assert provider order, precedence, pre- and post-processor behavior, glob expansion, and the final array returned by getMergedConfig(). Include a test for duplicate provider registration because InvalidConfigProviderException can surface when providers are added conditionally across service providers. Also test the Laravel side to confirm whether the aggregated array is consumed directly or mapped into ConfigRepository.
- What production concerns should I check before using laminas-config-aggregator in Laravel?
- The main risks are integration and ecosystem risk, not code complexity: there is no first-party Laravel service provider, no config-cache bridge, and duplicate provider detection can become a trap in conditional service-provider registration. The package is small, BSD-3-Clause, documented, and recently released under Laminas governance, but 42 stars and zero dependents mean little Laravel or high-traffic production evidence. Decide who owns the adapter, where any aggregator cache lives relative to Laravel's config cache, and whether procurement accepts the README's geopolitical statements.
- What are alternatives to laminas-config-aggregator for Laravel, and should I adopt it?
- For application-level configuration, Laravel's native config files, ConfigRepository, dotenv overrides, and config:cache are the default and usually the right alternative. For framework-agnostic packages, alternatives include a small in-house merge function, Symfony Config, or package-specific config classes; the aggregator's merge loop is trivial enough that lock-in is low but the case for a dependency is also limited. Adopt it only for a concrete need such as multi-format parsing, package defaults with precedence, or non-HTTP bootstrapping, and put it behind an internal interface with a fork or inline fallback.