PHPackages                             era269/normalizable - 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. era269/normalizable

ActiveLibrary

era269/normalizable
===================

OOP Normalization

v0.6.0(4y ago)19.1k↓34.4%2[2 PRs](https://github.com/era269/normalizable/pulls)1MITPHPPHP ^8.0|^7.1

Since Mar 28Pushed 4y ago1 watchersCompare

[ Source](https://github.com/era269/normalizable)[ Packagist](https://packagist.org/packages/era269/normalizable)[ RSS](/packages/era269-normalizable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (15)Used By (1)

normalizable
============

[](#normalizable)

[![PHP Stan Badge](https://camo.githubusercontent.com/5c3f647e9b98a35a0c07e86f075cf9f7ccc55ed24980200787ff83643cd0fc2c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d627269676874677265656e2e7376673f7374796c653d666c6174253232253345)](https://camo.githubusercontent.com/5c3f647e9b98a35a0c07e86f075cf9f7ccc55ed24980200787ff83643cd0fc2c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d627269676874677265656e2e7376673f7374796c653d666c6174253232253345)[![codecov](https://camo.githubusercontent.com/62997d85230b62fad91d50356d8ab5ed6bbde51ba9fbba455c274a7141f35457/68747470733a2f2f636f6465636f762e696f2f67682f6572613236392f6e6f726d616c697a61626c652f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4756395a303732314f49)](https://codecov.io/gh/era269/normalizable)

The normalization which is under the object control.

1. All private object properties should be ready for normalization. the normalization process is easy to customize by adding or changing the sequence of the normalizers in the `NormalizationFacade`
2. To allow the normalization customization Object has to implement the next interfaces:
    1. `NormalizableInterface`
    2. `NormalizationFacadeInterface`

Description:
------------

[](#description)

### NormalizableInterface

[](#normalizableinterface)

The basic interface. Could be used separately to build fully manual normalization. How:

1. any objet implements `NormalizableInterface`
2. It is called object::normalize in `NormalizableInterface::normalize` for all required to be present in normalized view objects

### NormalizableTrait

[](#normalizabletrait)

If it is needed to have all normalization happen automatically then `NormalizableTrait` has to be used with `NormalizableInterface`. In that case all objects should be supported by the `DefaultNormalizationFacade`

#### DefaultNormalizationFacade

[](#defaultnormalizationfacade)

Will normalize all private object properties by the next rules:

1. `AsIsKeyDecorator` the property name will become the array key without any decorations
2. all properties will be processed by predefined normalizers:
    1. `NotObjectNormalizer` will return not objects as is
    2. `ListNormalizableToNormalizableAdapterNormalizer` will process the array of normalizable objects
        1. all keys will be left as is `AsIsKeyDecorator`
        2. all values will be processed in according to the current rules by `DefaultNormalizationFacade`
    3. `NormalizableNormalizer` will call `NormalizableInterface::normalize`
    4. `WithTypeNormalizableNormalizerDecorator` is decorates the `NormalizableNormalizer` to add `@type` field with ShortClassName of normalized object
    5. `ScalarableNormalizer` will get the scalar value in object implements `ScalarableInterface`
    6. `StringableNormalizer` will get the scalar value in object implements `StringableInterface`
    7. and the last one is `FailNormalizer` which wil throw an exception if no Normalizer was found

### NormalizationFacadeAwareInterface

[](#normalizationfacadeawareinterface)

Should be implenented by all Normalizable objects to support the normalization customization. The normalization should be initiated by the custom `NormalizationFacade` implementation and it will be set to all Normalizable objects recursively

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.7% 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 ~34 days

Recently: every ~83 days

Total

11

Last Release

1531d ago

PHP version history (3 changes)0.1PHP ^7.4

v0.2PHP ^8.0

v0.5.0PHP ^8.0|^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9285866ec898fd3f66cea79ab67d1caf86f6b84c08d43ee80b6d6b2fe2aa66b6?d=identicon)[era269](/maintainers/era269)

---

Top Contributors

[![era269](https://avatars.githubusercontent.com/u/16477742?v=4)](https://github.com/era269 "era269 (18 commits)")[![leonardinius](https://avatars.githubusercontent.com/u/371909?v=4)](https://github.com/leonardinius "leonardinius (1 commits)")

---

Tags

encapsulationnormalizationnormalizeserializer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/era269-normalizable/health.svg)

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

PHPackages © 2026

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