chillerlan/php-settings-container
Lightweight settings container for PHP that decouples configuration logic from your application. Provides a SettingsContainerInterface with property-hook style access (for PHP < 8.4). Not a dependency injection container.
config/app.php from service classes).Config facade (e.g., dynamic trait-based behavior).FeatureToggleContainer with set_enabled() hooks).fromIterable().set_api_key() hashing sensitive values).cache:config with JSON-based settings stored in Redis or S3.Config or env()).For Executives: "This package lets us treat app configurations as first-class objects—immutable, type-safe, and extensible via reusable traits. For example, we could dynamically load feature flags from a JSON file, validate them with custom logic (e.g., rate limits), and inject them into services without polluting the global config. It’s like Laravel’s Config facade but with superpowers for complex scenarios, reducing tech debt in multi-tenant or serverless deployments."
For Engineers:
*"Replace scattered config() calls with a typed, immutable container. Key benefits:
use HashesApiKeys).$container->fromJSON($payload)).Example: Instead of:
if (config('features.new_ui.enabled') && auth()->user()->isPremium()) {
// ...
}
Use:
$settings = new FeatureSettings(['enabled' => true]);
if ($settings->isEnabledForPremiumUser(auth()->user())) { ... }
Tradeoff: Slight learning curve for traits/magic methods, but pays off in maintainability."*
How can I help you explore Laravel packages today?