PHPackages                             code-foundation/flow-config - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. code-foundation/flow-config

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

code-foundation/flow-config
===========================

Cascading key/value configuration of preferences for platforms, installs, and users.

0.3.0(6y ago)32.3k↓74.3%3[2 issues](https://github.com/code-foundation/flow-config/issues)3MITPHPPHP &gt;=7.3.0CI failing

Since May 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/code-foundation/flow-config)[ Packagist](https://packagist.org/packages/code-foundation/flow-config)[ Docs](https://github.com/code-foundation/flow-config)[ RSS](/packages/code-foundation-flow-config/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (4)Versions (10)Used By (3)

Status
======

[](#status)

[![Latest Stable Version](https://camo.githubusercontent.com/510e31598aea25d50f250a5df9fa6b8ff035d8422e9460cd05781b8be5f9bcce/68747470733a2f2f706f7365722e707567782e6f72672f636f64652d666f756e646174696f6e2f666c6f772d636f6e6669672f762f737461626c65)](https://packagist.org/packages/code-foundation/flow-config) [![License](https://camo.githubusercontent.com/d8acbe04f97f5592aca4ebd3b38411d020cec61fafb450d00620e9307bd5045c/68747470733a2f2f706f7365722e707567782e6f72672f636f64652d666f756e646174696f6e2f666c6f772d636f6e6669672f6c6963656e7365)](https://packagist.org/packages/code-foundation/flow-config) [![codecov](https://camo.githubusercontent.com/02e4f60af820e3cf3ee9b75715259a39325ab477af7a12a4e437e5e9435bdda2/68747470733a2f2f636f6465636f762e696f2f67682f636f64652d666f756e646174696f6e2f666c6f772d636f6e6669672f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/code-foundation/flow-config)[![CircleCI](https://camo.githubusercontent.com/909b1c1f8c5ee1f17cdf4e167ac959ae8ee323c647086a9bdc16d1b5785dd897/68747470733a2f2f636972636c6563692e636f6d2f67682f636f64652d666f756e646174696f6e2f666c6f772d636f6e6669672e7376673f7374796c653d737667)](https://circleci.com/gh/code-foundation/flow-config)

Introduction
============

[](#introduction)

Flow Config is a key value configuration platform built on top of doctrine. It provides an PHP API for setting configuration at the platform that can be set by an install, and then set for a user, or other entity. Defaults are set in a single location, rather than scattering them through the code.

Installation
============

[](#installation)

```
composer require code-foundation/flow-config
```

Usage
=====

[](#usage)

Attach the EntityIdentifier interface to user classes
-----------------------------------------------------

[](#attach-the-entityidentifier-interface-to-user-classes)

This allows EntityConfig classes to use the above

```
class User implements CodeFoundation\FlowConfig\Interfaces\EntityIdentifier
{
    public function getEntityType(): string
    {
        return 'user';
    }

    public function getEntityId(): string
    {
        return $this->id;
    }
}
```

Build configuration classes
---------------------------

[](#build-configuration-classes)

```
// Build a read-only config
$baseConfig = new ReadonlyConfig([
    'timezone' => 'UTC'
]);

// Build a system config
$systemConfig = new DoctrineConfig($this->getEntityManager());

// Build a entity based config
$entityConfig = new DoctrineEntityConfig($this->getEntityManager());

// Build the cascading configuration objects that tries each of the above in turn.
$cascadeConfig = new CascadeConfig($baseConfig, $systemConfig, $entityConfig);
```

If you don't want the Config services to automatically flush changes to the database, pass a false for `$autoFlush` in the constructor of the service.

```
$systemConfig = new DoctrineConfig($this->getEntityManager(), false);

$entityConfig = new DoctrineEntityConfig($this->getEntityManager(), false);
```

Control key access using the AccessControlInterface
---------------------------------------------------

[](#control-key-access-using-the-accesscontrolinterface)

In some cases, you may wish to control each specific attempt to get/set specific keys, and this is where implementing the AccessControlInterface is useful.

By default, the `NullAccessControl` class is instantiated, which defaults to allowing all `get` and `set` attempts.

By implementing the interface, you have control over allowing or denying get and set access to keys based on the key itself, or optionally the entity associated with the key, or one of its method values.

```
class MyAccessControlClass implements AccessControlInterface
{
    // Set our read-only keys.
    private $readOnlyKeys = ['abc123'];

    // Set our keys that are restricted and never returned.
    private $restrictedKeys = ['xyz987'];

    // Set entities that cannot be modified
    private $readOnlyEntities = [MyEntityClass::class];

    public function canGetKey(string $key, ?EntityIdentity $entity = null): bool
    {
        // Return whether the key is not in our read-only array.
        return \in_array($key, $this->readOnlyKeys) === false;
    }

    public function getSetKey(string $key, ?EntityIdentity $entity = null): bool
    {
        // Check whether the key is in our restricted array.
        if (\in_array($key, $this->restrictedKeys) === true) {
            return false;
        }

        // Check whether the entity is read only
        if ($entity !== null && in_array(\get_class($entity), $this->readOnlyEntities) === true) {
            return false;
        }

        return true;
    }
}
```

Examples
--------

[](#examples)

```
$user1 = new User()->setId(999);
$user1 = new User()->setId(1001);

echo $systemConfig->get('timezone'); // UTC
echo $entityConfig->get('timezone'); // UTC
echo $cascadeConfig->getEntityConfigItem('timezone', $user1); // UTC
echo $cascadeConfig->getEntityConfigItem('timezone', $user2); // UTC

// Update the setting for that platform.
$entityConfig->set('timezone', 'Australia/Melbourne');
echo $systemConfig->get('timezone'); // UTC
echo $entityConfig->get('timezone'); // 'Australia/Melbourne'
echo $cascadeConfig->getEntityConfigItem('timezone', $user1); // 'Australia/Melbourne'
echo $cascadeConfig->getEntityConfigItem('timezone', $user2); // 'Australia/Melbourne'

// Update a given users settings
$cascadeConfig->setByEntity($user1, 'timezone', 'Pacific/Auckland');
echo $systemConfig->get('timezone'); // UTC
echo $entityConfig->get('timezone'); // 'Australia/Melbourne'
echo $cascadeConfig->getEntityConfigItem('timezone', $user1); // 'Pacific/Auckland'
echo $cascadeConfig->getEntityConfigItem('timezone', $user2); // 'Australia/Melbourne'
```

Supported platforms
===================

[](#supported-platforms)

- PHP 7.3+
- Doctrine
- Symfony -

Future plans
============

[](#future-plans)

- Validation
- Allowed values
- Factories
- Eloquent backend

Contact
=======

[](#contact)

Github: Email:

License
=======

[](#license)

Flow Config is distributed under the MIT license.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Recently: every ~38 days

Total

9

Last Release

2308d ago

PHP version history (2 changes)0.0.1PHP &gt;=7.1.0

0.3.0PHP &gt;=7.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e9d2b9450d2213cb53866b3a27a7be6403239d23e43ab54965228536913bb74a?d=identicon)[edward-murrell](/maintainers/edward-murrell)

---

Top Contributors

[![edward-murrell](https://avatars.githubusercontent.com/u/872124?v=4)](https://github.com/edward-murrell "edward-murrell (76 commits)")[![brendonofficial](https://avatars.githubusercontent.com/u/4957574?v=4)](https://github.com/brendonofficial "brendonofficial (8 commits)")[![rashmitsingh](https://avatars.githubusercontent.com/u/47509325?v=4)](https://github.com/rashmitsingh "rashmitsingh (4 commits)")[![ketanp77](https://avatars.githubusercontent.com/u/37789589?v=4)](https://github.com/ketanp77 "ketanp77 (1 commits)")[![merk](https://avatars.githubusercontent.com/u/278097?v=4)](https://github.com/merk "merk (1 commits)")

---

Tags

configurationconfigUsersentities

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/code-foundation-flow-config/health.svg)

```
[![Health](https://phpackages.com/badges/code-foundation-flow-config/health.svg)](https://phpackages.com/packages/code-foundation-flow-config)
```

###  Alternatives

[symfony/options-resolver

Provides an improved replacement for the array\_replace PHP function

3.2k493.9M1.6k](/packages/symfony-options-resolver)[league/config

Define configuration arrays with strict schemas and access values with dot notation

564302.2M24](/packages/league-config)[dflydev/dot-access-configuration

Given a deep data structure representing a configuration, access configuration by dot notation.

13414.5M4](/packages/dflydev-dot-access-configuration)[dmishh/settings-bundle

Database centric Symfony configuration management. Global and per-user settings supported.

115254.9k1](/packages/dmishh-settings-bundle)[caseyamcl/configula

A simple, but versatile, PHP config loader

42146.6k6](/packages/caseyamcl-configula)[illuminatech/array-factory

Allows DI aware object creation from array definition

2159.6k6](/packages/illuminatech-array-factory)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
