PHPackages                             tasoft/key-value-coding - 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. tasoft/key-value-coding

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

tasoft/key-value-coding
=======================

PHP library to enable key-value coding for your objects.

1.1(9y ago)09MITPHPPHP ^5.3.3 || ^7.0

Since Mar 7Pushed 8y agoCompare

[ Source](https://github.com/tasoftch/key-value-coding)[ Packagist](https://packagist.org/packages/tasoft/key-value-coding)[ Docs](https://github.com/TASoftApplications/key-value-coding)[ RSS](/packages/tasoft-key-value-coding/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Key Value Coding
================

[](#key-value-coding)

PHP Library to implement key-value coding This library defined 3 interfaces to enable key-value coding, key-value changing and key-value observing. Key-value coding is known as accessing properties, such as attributes or relationships of an object via keys. The key-value-coding library ships with 2 traits that implement the coding and changing interfaces.

Usage
-----

[](#usage)

Every object that has methods named get\* and set\* can be used for key-value coding. The Object\\CodingTrait implements the default mechanism which has the following workflow:
Getting a key:

```
echo $object->userName;

```

will do:

```
$object->__get("userName");
$object->valueForKey("userName");
$object->getDefinedKeys();
// If key does exist
$object->getUserName();
// If key does not exist
$object->valueForUndefinedKey("userName");

```

and the same for

```
$object->userName = "tasoft";

```

but using the \_\_set, setValueForKey, setUserName or setValueForUndefinedKey instead.

### Key Paths

[](#key-paths)

Keypaths are defined as identifier to trace objects by its relationships. For example, an address object contains an attribute named country and a user contains a relationship to an address object, you can access the country attribute by using

```
echo $user->valueForKeyPath("address.country");
// or
echo $user["address.country"];

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

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

Every ~0 days

Total

2

Last Release

3355d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c7b1a2883faeab6f2b9558df70ce847c9e7dc3467a64db4f694e0716e842e9f2?d=identicon)[tasoft](/maintainers/tasoft)

---

Top Contributors

[![tasoftch](https://avatars.githubusercontent.com/u/24875322?v=4)](https://github.com/tasoftch "tasoftch (25 commits)")

---

Tags

tracingkeycodingvalue

### Embed Badge

![Health badge](/badges/tasoft-key-value-coding/health.svg)

```
[![Health](https://phpackages.com/badges/tasoft-key-value-coding/health.svg)](https://phpackages.com/packages/tasoft-key-value-coding)
```

###  Alternatives

[stechstudio/laravel-php-cs-fixer

Easily format your Laravel Code with this Configuration file and accompanying artisan command.

146718.6k2](/packages/stechstudio-laravel-php-cs-fixer)[gladcodes/keygen

A fluent PHP random key generator.

119668.9k2](/packages/gladcodes-keygen)[napp/xray-laravel

AWS X-Ray for Laravel applications.

61407.3k](/packages/napp-xray-laravel)[jaybizzle/hasmeta

Access model meta data as if it was a property on your model

291.9k](/packages/jaybizzle-hasmeta)[mnapoli/pretty

Run all code formatting tools with one command: pretty

1085.1k9](/packages/mnapoli-pretty)[brysem/phpenums

Enums made simple in PHP.

10171.5k](/packages/brysem-phpenums)

PHPackages © 2026

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