laminas/laminas-config
Abandoned Laminas library for managing application configuration. Provides config containers and utilities (e.g., reading/merging structured config) used across Laminas/Zend-style apps. No further development; see Laminas TSC minutes for details.
Start by installing the package via Composer (composer require laminas/laminas-config) and creating a config.php file that returns an associative array (e.g., database credentials, app settings). Use Laminas\Config\Config to wrap the array and access values like $config->database->host. The API is intentionally simple: use dot notation ($config->app->debug) or array access ($config['app']['debug']) to traverse nested structures. The first use case is usually loading environment-specific config: merge local overrides (e.g., config.local.php) with a base config using Config::fromFile() and Config::fromArray().
Config::fromFile('config.php'), then layer environment-specific changes using Config::set() or Config::toArray() + Config::fromArray() to merge.routes.php, services.php) into a single Config object by iterating over files and merging with Config::setFromProperty() or manual array merging before wrapping.Config objects directly into factory classes—e.g., pass $config->db to a PDO factory. This decouples configuration from instantiation logic.Config::offsetGet() or cast to primitive types ((string) $config->app->timeout) to avoid type surprises at runtime.__isset() Support: isset($config->missing->key) throws a notice. Always use $config->offsetExists('missing') or check via array_key_exists() after converting to array.ArrayObject instances—so gettype($config->app) is object, not array. To force arrays, call $config->toArray() before processing.['db' => ['host' => 'a']] into ['db' => ['port' => 3306]] loses port). Use Config::setFromProperty() per-level or pre-merge arrays with array_replace_recursive() first.symfony/config, but this remains safe for legacy/maintained apps where minimal dependencies matter.ConfigInterface: To add behavior (e.g., validation), implement Laminas\Config\AggregatorInterface or subclass Laminas\Config\Config and override offsetGet() for custom defaults.How can I help you explore Laravel packages today?