Synthesizes low-level configurations.

v1.3.0 2021-07-19 23:06 UTC

This package is auto-updated.

Last update: 2024-05-30 00:52:09 UTC


Packagist Code Quality Code Coverage Downloads

An API to build low-level configuration.

This package is used by the framework ICanBoogie to configure its components.

Configurations are defined by a set of files called fragments. Builders use these fragments to build configurations. Configurations are managed by a Config instance. Configurations can be cached, which cancels the cost of the builds.


composer require icanboogie/config

Configuration fragments

A configuration fragment is a PHP file returning a callable. Multiple fragments are used to build a configuration. They are usually located in "config" directories and are usually named after the config they are used to build.

The configuration

The configuration is represented by a Config instance, which is used as an array to access specific configurations.

The following example demonstrates how to obtain a configuration of class MyConfig:


/* @var \ICanBoogie\Config $config */

$my_config = $config->config_for_class(MyConfig::class);

A NoBuilderDefined exception is thrown if there is no builder defined for a configuration class.

Configuration builders

Builders are defined for each configuration.


use ICanBoogie\Config;

/* @var string[] $paths */

$builders = [ MyConfig::class => MyBuilder::class ];
$config = new Config($paths, builders);
$my_config = $config->config_for_class(MyConfig::class);

Caching configurations

Caching configurations removes the cost of building by reusing the result of a previous build. To enable caching, you just need to provide a cache implementing Storage.


namespace ICanBoogie;

$config = new Config($paths, $builders, $cache);

Continuous Integration

The project is continuously tested by GitHub actions.

Tests Static Analysis Code Style

Code of Conduct

This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you are expected to uphold this code.


Please see CONTRIBUTING for details.


icanboogie/config is released under the BSD-3-Clause.