PHPackages                             burzum/cakephp-config-objects - 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. burzum/cakephp-config-objects

AbandonedArchivedCakephp-plugin

burzum/cakephp-config-objects
=============================

Config objects instead of arrays

1.0.0-rc1(8y ago)10[1 PRs](https://github.com/burzum/cakephp-config-objects/pulls)MITPHP

Since Jul 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/burzum/cakephp-config-objects)[ Packagist](https://packagist.org/packages/burzum/cakephp-config-objects)[ RSS](/packages/burzum-cakephp-config-objects/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Object Config for CakePHP
=========================

[](#object-config-for-cakephp)

Objects!? Why not arrays?
-------------------------

[](#objects-why-not-arrays)

You should use objects instead of arrays because:

- An array can't be type checked if it really is the intended config
- It is easy to have typos in config arrays
- The configuration is separated from the class unlike when using `InstanceConfigTrait`
- Optional bonus: An array doesn't bring easy validation of config data with it

So instead of doing something like

```
class Foo(array $config);
```

do this

```
class Foo(FooConfig $config);
```

How to use it
-------------

[](#how-to-use-it)

Create your configuration object:

```
use Burzum\ObjectConfig\Config;

class FooConfig extends Config {

	protected $_defaultConfig = [
		// Set your default values here
	];

	/* Your setter / getter methods go here */
}
```

Then just use it:

```
$config = new FooConfig();
$config->setBar('some-value);

class Foo {

	protected $config;

	public function __construct(FooConfig $config)
	{
		$this->config = $config;
	}
}

$foo = new Foo($config);
```

### Migrating arrays to objects

[](#migrating-arrays-to-objects)

For a soft migration path you can still do this:

```
class Foo {

	protected $config;

	public function __construct(array $config = [])
	{
		$this->config = FooConfig::createFromArray($config);
	}
}
```

### Array access

[](#array-access)

The `Config` class implements `\ArrayAccess`. So even when you change the signature of a method to require a specific type of object, your underlying code can still access the config like an array:

```
$config = new Config();
$config['arrayaccess'] = 'value';

echo $config['arrayaccess'];
```

Or you can simply get the whole config as array by calling:

```
$configArray = $config->toArray();
```

License
-------

[](#license)

Copyright 2013 - 2017 Florian Krämer

Licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) License. Redistributions of the source code included in this repository must retain the copyright notice found in each file.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3237d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0643e6255da841fe65260ec6e263d8908a40a84b884c32e9fc6be6a15e252fa8?d=identicon)[burzum](/maintainers/burzum)

---

Top Contributors

[![burzum](https://avatars.githubusercontent.com/u/162789?v=4)](https://github.com/burzum "burzum (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/burzum-cakephp-config-objects/health.svg)

```
[![Health](https://phpackages.com/badges/burzum-cakephp-config-objects/health.svg)](https://phpackages.com/packages/burzum-cakephp-config-objects)
```

###  Alternatives

[friendsofcake/cakepdf

CakePHP plugin for creating and/or rendering Pdfs, several Pdf engines supported.

3752.1M3](/packages/friendsofcake-cakepdf)[cakephp/bake

Bake plugin for CakePHP

11211.2M158](/packages/cakephp-bake)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[dereuromark/cakephp-queue

The Queue plugin for CakePHP provides deferred task execution.

308850.3k14](/packages/dereuromark-cakephp-queue)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1862.1M27](/packages/dereuromark-cakephp-ide-helper)[dereuromark/cakephp-tinyauth

A CakePHP plugin to handle user authentication and authorization the easy way.

129228.6k10](/packages/dereuromark-cakephp-tinyauth)

PHPackages © 2026

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