PHPackages                             jadob/objectable - 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. jadob/objectable

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

jadob/objectable
================

v0.9.2(1y ago)01.2kMITPHPPHP ^8

Since Feb 6Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/jadob/objectable)[ Packagist](https://packagist.org/packages/jadob/objectable)[ RSS](/packages/jadob-objectable/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (40)Used By (0)

jadob/objectable
================

[](#jadobobjectable)

Reflection-based class normalizer.

Usage
-----

[](#usage)

```
class UserReadModel {

    public function __construct(
    #[\Jadob\Objectable\Annotation\Field(name: 'username', context: ['PUBLIC_API', 'PRIVATE_API'])]
    private string $username,

    #[\Jadob\Objectable\Annotation\Field(name: 'banReason',  context: ['PRIVATE_API'])]
    private string $banReason,

    #[\Jadob\Objectable\Annotation\Field(name: 'createdAt',  context: ['PUBLIC_API', 'PRIVATE_API'], dateFormat: 'Y-m-d')]
    private DateTimeInterface $createdAt
    ) {

    }
}

$user = new UserReadModel('mickey', 'spam', new DateTime('2012-12-12'));

$itemProcessor = new \Jadob\Objectable\ItemProcessor();

/**
 *  ['username' => 'mickey', 'createdAt' => '2012-12-12']
 */
$publicResponse = $itemProcessor->extractItemValues($user, 'PUBLIC_API');

/**
 *  ['username' => 'mickey', 'banReason' => 'spam', 'createdAt' => '2012-12-12']
 */
$managementResponse = $itemProcessor->extractItemValues($user, 'PRIVATE_API');
```

When you need to handle specific use case, you can create a class implementing `Jadob\Objectable\Transformer\ItemTransformerInterface` and pass them to `ItemProcessor`:

```
class MyClass {
    public function __construct(
        public string $key
    ) {}
}

class TopSecretTransformer implements \Jadob\Objectable\Transformer\ItemTransformerInterface {

    public function supports(string $className,string $context) : bool {

        return $className === MyClass::class && $context === 'TOP_SECRET';
    }

    /**
     * @param MyClass $object
     * @return array
     */
    public function process(object $object) : array{
        return [
            'key' => str_rot13($object->key)
        ];
    }
}

$itemProcessor = new \Jadob\Objectable\ItemProcessor(
    itemTransformers: [
        new TopSecretTransformer()
    ]
);

/**
 * ['key' => 'uryyb']
 */
$result = $itemProcessor->extractItemValues(new MyClass('hello'), 'TOP_SECRET');
```

When any transformer would be matched, `extractItemValues` will return the values from transformers, no further processing will be done.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance54

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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 ~30 days

Recently: every ~0 days

Total

39

Last Release

436d ago

PHP version history (2 changes)v0.4.1PHP ^7.3.0

v0.4.3PHP ^8

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13077797?v=4)[Mikolaj Czajkowski](/maintainers/pizzaminded)[@pizzaminded](https://github.com/pizzaminded)

---

Top Contributors

[![pizzaminded](https://avatars.githubusercontent.com/u/13077797?v=4)](https://github.com/pizzaminded "pizzaminded (38 commits)")

### Embed Badge

![Health badge](/badges/jadob-objectable/health.svg)

```
[![Health](https://phpackages.com/badges/jadob-objectable/health.svg)](https://phpackages.com/packages/jadob-objectable)
```

PHPackages © 2026

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