aaronadal/config-bundle
Symfony bundle that loads configuration from multiple YAML files automatically. Define default and environment-specific glob paths; files in the current environment override defaults. Uses Symfony cache for fast startup and cleaner parameter/service management.
config/ files, environment variables, and config/caching.php) differs fundamentally from Symfony’s parameter/environment-based approach.config/app.php for defaults, config/app-{env}.php for overrides).ParameterBag, Container, and Kernel classes, which are incompatible with Laravel’s Illuminate\Config and Illuminate\Container.mergeConfigFrom or custom service providers).DependencyInjection, Config, and Filesystem components are not available in Laravel.ConfigRepository.ParameterBag with Laravel’s array-based config.APP_ENV, not Symfony’s Kernel)..env, config/app-{env}.php). Is this bundle’s modular YAML approach a must-have?config/caching.php, custom providers)?ContainerInterface vs. Laravel’s Illuminate\Container.ParameterBag vs. Laravel’s ConfigRepository.Kernel vs. Laravel’s App facade.| Step | Action | Laravel Equivalent/Alternative |
|---|---|---|
| 1 | Install via Composer | composer require aaronadal/config-bundle → Not recommended (Symfony dependency conflict). |
| 2 | Register Bundle in Kernel | N/A (Laravel uses AppServiceProvider). |
| 3 | Define Config Locations (YAML globs) | Replace with JSON/YAML files in config/ + custom loader. |
| 4 | Load Defaults + Environment Overrides | Use Laravel’s config() helper with merged arrays or a custom service provider. |
| 5 | Cache Configs | Laravel’s config:cache already does this. |
Recommended Migration:
config/app.phpconfig/app-{env}.php or .env variables.config/caching.php or a custom provider.config/{defaults,env}/.merge() to handle overrides.// app/Providers/ConfigBundleProvider.php
public function boot() {
$defaults = collect(config('config-bundle.defaults'))->map(fn($path) => yaml_to_array($path));
$envOverrides = collect(config("config-bundle.env.{$this->app->environment()}"))->map(fn($path) => yaml_to_array($path));
$this->app['config']->set('merged', $defaults->merge($envOverrides));
}
APP_ENV.spatie/array-to-object or symfony/yaml for YAML parsing.File::glob() or collect(config_files)->each().config:cache..env, config/caching).laravel-config-bundle) if reuse is needed across projects.yaml component, lock to a specific version to avoid breaking changes.ParameterBag) won’t translate to Laravel./config
/defaults
database.yml # Loaded always
/production
database.yml # Overrides defaults in prod
config:cache already optimizes loading; this bundle adds minimal overhead.| Failure Scenario | Impact | Mitigation | |------------------|--------
How can I help you explore Laravel packages today?