PHPackages                             romm/configuration-object - 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. romm/configuration-object

AbandonedArchivedTypo3-cms-extension[Utility &amp; Helpers](/categories/utility)

romm/configuration-object
=========================

Transform any configuration plain array into a dynamic and configurable object structure, and pull apart configuration handling from the main logic of your script. Use provided services to add more functionality to your objects: cache, parents, persistence and much more.

2.0.0(7y ago)729.5k4[2 PRs](https://github.com/romm/configuration_object/pulls)2GPL-3.0-or-laterPHPPHP ^7.1

Since Aug 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/romm/configuration_object)[ Packagist](https://packagist.org/packages/romm/configuration-object)[ RSS](/packages/romm-configuration-object/feed)WikiDiscussions development Synced 2mo ago

READMEChangelog (10)Dependencies (5)Versions (26)Used By (2)

[![Configuration Object](Documentation/Images/configuration-object-icon@medium.png)](Documentation/Images/configuration-object-icon@medium.png) Configuration Object
====================================================================================================================================================================

[](#-configuration-object)

> **Warning** This package is no longer maintained. As a more stable alternative, you may use package [`cuyz/valinor`](https://github.com/CuyZ/Valinor).

ℹ️ Show more info> [![Build Status](https://camo.githubusercontent.com/72169c211e9c5e3d02d9cf4a764aebbdc03adf630f42aa9e1cbf494739f51603/68747470733a2f2f7472617669732d63692e6f72672f726f6d6d2f636f6e66696775726174696f6e5f6f626a6563742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/romm/configuration_object) [![Coverage Status](https://camo.githubusercontent.com/fcda8d8194858a457c056512d38bb22f8f87cc1e460e8b498598e1e3c9e67a10/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f726f6d6d2f636f6e66696775726174696f6e5f6f626a6563742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/romm/configuration_object?branch=master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/18b656e5e7e5766e4cac5787276659af56fe4d787ef373cfd44d5ee4bcb94722/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f726f6d6d2f636f6e66696775726174696f6e5f6f626a6563742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/romm/configuration_object/?branch=master) [![Latest Stable Version](https://camo.githubusercontent.com/a86f09b29a8f4250af3e2ad61c7f26d36ad3f53f59e4689c92811ce9daa27c97/68747470733a2f2f706f7365722e707567782e6f72672f726f6d6d2f636f6e66696775726174696f6e2d6f626a6563742f762f737461626c65)](https://packagist.org/packages/romm/configuration-object) [![Total Downloads](https://camo.githubusercontent.com/0388e37f16c5e755c6f46a2a8f3f13173d4c257f7574838202d07ac635b82658/68747470733a2f2f706f7365722e707567782e6f72672f726f6d6d2f636f6e66696775726174696f6e2d6f626a6563742f646f776e6c6f616473)](https://packagist.org/packages/romm/configuration-object) [![SensioLabs Insight](https://camo.githubusercontent.com/79e83ba1acbfb1171f6998a1216cde74e1d978460387df49ec11f4c8188e7401/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f38366464643965302d666632392d343838362d623034612d6138653237393937613661662e737667)](https://insight.sensiolabs.com/projects/86ddd9e0-ff29-4886-b04a-a8e27997a6af) [![StyleCI](https://camo.githubusercontent.com/b3c204316b061bcfc1d4be0005a79afa1f8239abc426359bb30c949e646f93a7/68747470733a2f2f7374796c6563692e696f2f7265706f732f36363434383934382f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/66448948)

> ❗ *This PHP library has been developed for [![TYPO3](Resources/Public/Images/typo3-icon.png)TYPO3 CMS](https://typo3.org) and is intended to TYPO3 extension developers.*

> ➡️ *You can find the whole documentation on the [TYPO3 official website](https://docs.typo3.org/typo3cms/extensions/configuration_object/), or even download the [🔗PDF version](https://docs.typo3.org/typo3cms/extensions/configuration_object/_pdf/)*.

---

Introduction
------------

[](#introduction)

[![Configuration Object](Documentation/Images/configuration-object-icon@small.png)](Documentation/Images/configuration-object-icon@small.png) **Configuration Object** provides **powerful tools for handling configuration trees**, by converting any **configuration plain array** (which can come from sources like **TypoScript, JSON, XML**) into a much more **flexible PHP object structure**. Its principal goal is to **pull apart the configuration handling from the main logic of an application**, so the script can focus on **using the already validated configuration during its whole process**.

### Problem

[](#problem)

When a script uses a configuration tree to handle parts of an application, this tree is often **analyzed step by step during the script execution**; if a value contains a mistake, the script can be forced to stop, too early (*the whole process did not run entirely*) but also too late (*some sensitive operations may already have run*). Moreover, **the deeper** the configuration tree is, **the harder** it is to handle and prevent all the possible configuration mistakes.

When it comes to configuration which may be customized by any third-party user (which happens often in TYPO3 thanks to TypoScript), validation rules have to be **well thought and strong** to prevent the user from breaking your own API scripts because of a configuration mistake.

### Solution

[](#solution)

Use **Configuration Object** to export the handling of your configuration: let the whole **creation and validation processes be managed outside of your application**, and enjoy the **many other features provided by the API** (cache management, parents, persistence and more).

It is **simple, fast and reliable**.

Example
-------

[](#example)

Imagine you have this configuration array:

```
$myCompany = [
    'name'      => 'My Company',
    'employees' => [
        [
            'name'   => 'John Doe',
            'gender' => 'Male',
            'email'  => 'john.doe@my-company.com'
        ],
        [
            'name'   => 'Jane Doe',
            'gender' => 'Female',
            'email'  => 'jane.doe@my-company.com'
        ]
    ]
];
```

While this example is quite simple, it allows us to understand easily how this API works.

Below stands an example of how this configuration could look like using **Configuration Object API**.

You can see that **two services** are used:

- **Cache service**

    It will store the whole company object, and its sub-objects, in a cache entry after they have been created. This will improve performances for next times the object must be fetched.
- **Parents service**

    With this service, the class `Employee` is able to retrieve the data from its parent (the class `Company`). In this example, we use it to dynamically generate an email address for the employee, if none was assigned.

```
namespace MyVendor\MyExtensions\Company;

use Romm\ConfigurationObject\ConfigurationObjectInterface;
use Romm\ConfigurationObject\Traits\ConfigurationObject\DefaultConfigurationObjectTrait;
use Romm\ConfigurationObject\Traits\ConfigurationObject\MagicMethodsTrait;
use MyVendor\MyExtensions\Model\Company\Employee;

class Company implements ConfigurationObjectInterface
{
    use DefaultConfigurationObjectTrait;
    use MagicMethodsTrait;

    const CACHE_NAME = 'cache_company';

    /**
     * @var string
     * @validate NotEmpty
     */
    protected $name;

    /**
     * @var \ArrayObject
     */
    protected $employees;

    /**
     * @return ServiceFactory
     */
    public static function getConfigurationObjectServices()
    {
        return ServiceFactory::getInstance()
            ->attach(ServiceInterface::SERVICE_CACHE)
            ->setOption(CacheService::OPTION_CACHE_NAME, self::CACHE_NAME)
            ->attach(ServiceInterface::SERVICE_PARENTS);
    }
}
```

---

```
namespace MyVendor\MyExtensions\Company;

use Romm\ConfigurationObject\Service\Items\Parents\ParentsTrait;
use Romm\ConfigurationObject\Traits\ConfigurationObject\MagicMethodsTrait;

class Employee
{
    use ParentsTrait;
    use MagicMethodsTrait;

    /**
     * @var string
     * @validate NotEmpty
     */
    protected $name;

    /**
     * @var string
     * @validate NotEmpty
     * @validate Romm.ConfigurationObject:HasValues(values=Male|Female)
     */
    protected $gender;

    /**
     * @var string
     * @validate EmailAddress
     */
    protected $email;

    /**
     * Returns the email of the employee.
     *
     * If the email was not registered, a default one is assigned to
     * him, based on its name and its company name.
     *
     * Example: `John Doe` of the company `My Company` will be assigned
     * the default email: `john.doe@my-company.com`.
     *
     * @return string
     */
    public function getEmail()
    {
        if (null === $this->email
            && $this->hasParent(Company::class)
        ) {
            $sanitizedEmployeeName = SomeUtility::sanitizeStringForEmail($this->getName());

            $company = $this->getParent(Company::class);
            $sanitizedCompanyName = SomeUtility::sanitizeStringForEmail($company->getName(), '-');

            $this->email = vprintf(
                '%s@%s.com',
                [$sanitizedEmployeeName, $sanitizedCompanyName]
            );
        }

        return $this->email;
    }
}
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~40 days

Recently: every ~157 days

Total

23

Last Release

2671d ago

Major Versions

1.10.1 → 2.0.02019-01-21

PHP version history (2 changes)1.0.0PHP &gt;=5.5

2.0.0PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a68d1d1332665e5173e7702415c77bcedf41521bbc540cad7429a1230c941e4?d=identicon)[Romm](/maintainers/Romm)

---

Top Contributors

[![romm](https://avatars.githubusercontent.com/u/6342901?v=4)](https://github.com/romm "romm (136 commits)")

---

Tags

configurationextbaseobjecttypo3configurationmodelobjecttypo3

### Embed Badge

![Health badge](/badges/romm-configuration-object/health.svg)

```
[![Health](https://phpackages.com/badges/romm-configuration-object/health.svg)](https://phpackages.com/packages/romm-configuration-object)
```

###  Alternatives

[in2code/powermail

Powermail is a well-known, editor-friendly, powerful and easy to use mailform extension for TYPO3 with a lots of features

982.5M38](/packages/in2code-powermail)[wazum/sluggi

TYPO3 extension for URL slug management with inline editing, auto-sync, locking, access control, and redirects

39488.5k](/packages/wazum-sluggi)[in2code/powermail_cond

Add conditions (via AJAX) to powermail forms for fields and pages

10530.6k](/packages/in2code-powermail-cond)[jweiland/events2

Events 2 - Create single and recurring events

2062.4k2](/packages/jweiland-events2)[quellenform/t3x-iconpack

Provides an iconpack-registry for custom iconpacks.

1542.7k25](/packages/quellenform-t3x-iconpack)

PHPackages © 2026

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