yiisoft/composer-config-plugin
.env, YAML, JSON) without hardcoding values, aligning with 12-factor app principles. Critical for CI/CD pipelines, staging, and production parity.composer du -v) to troubleshoot misconfigurations, critical for SRE-driven or DevOps-heavy teams.Avoid if:
config/app.php) with minimal dependencies. Overhead of this plugin may not justify benefits.yiisoft/config or spatie/laravel-config-array for validation).Adopt if:
.env for secrets, YAML for multi-tier settings) without manual merging.params-local.php without modifying package files).*"This package lets us treat configurations as first-class citizens in our PHP/Laravel ecosystem—just like code. Instead of manually merging config/*.php files or hardcoding settings, we can package configs with our libraries or microservices. For example:
auth.php config, including default providers and rules..env files for environment-specific values (e.g., APP_DEBUG=true in dev) without polluting the codebase.This reduces technical debt, speeds up onboarding (new devs get configs "for free"), and makes our system more resilient to changes. It’s like Composer for configs—automated, versioned, and dependency-aware."*
Business Impact:
composer install, eliminating manual setup.*"This plugin solves two key pain points:
config/*.php file overrides another. The plugin merges configs in a predictable order (root > packages) and supports wildcards (../src/Modules/*/config/web.php) for modular setups..env files, YAML, or JSON alongside PHP configs, with runtime overrides (e.g., params-local.php). Perfect for local dev, staging, and production.How to Use It:
composer.json under extra/config-plugin:
"config-plugin": {
"envs": ".env",
"params": ["config/params.php", "?config/params-local.php"],
"web": ["$params", "config/web.php"]
}
Yiisoft\Composer\Config\Builder::require('web').composer dump-autoload --verbose to see the dependency tree.Trade-offs:
yiisoft/config, but this plugin is battle-tested and simpler for basic use cases.composer install/update (add composer du to your CI/CD pipeline).When to Avoid:
Call to Action: "Let’s pilot this for our [Auth Service/Microservice X] to see how it simplifies config management. We’ll compare it to our current approach in a 2-week spike."
How can I help you explore Laravel packages today?