PHPackages                             thunderer/serializard - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. thunderer/serializard

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

thunderer/serializard
=====================

Flexible serializer

v0.4.0(5y ago)2767.3k↓42.3%1[1 issues](https://github.com/thunderer/Serializard/issues)1MITPHPPHP ^5.5|^7.0|^8.0

Since Feb 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/thunderer/Serializard)[ Packagist](https://packagist.org/packages/thunderer/serializard)[ RSS](/packages/thunderer-serializard/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (11)Used By (1)

Serializard
===========

[](#serializard)

[![Build Status](https://camo.githubusercontent.com/aca154dd68497fb0d52ccb116dc90c5dfdf6d9b0ead2b77e7bf4a55600439630/68747470733a2f2f7472617669732d63692e6f72672f7468756e64657265722f53657269616c697a6172642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/thunderer/Serializard)[![Latest Stable Version](https://camo.githubusercontent.com/ac98561cc95b7fb5f5dc9c334caab6e3aff69a8ead7173abd6da64589831f0c4/68747470733a2f2f706f7365722e707567782e6f72672f7468756e64657265722f73657269616c697a6172642f762f737461626c65)](https://packagist.org/packages/thunderer/serializard)[![License](https://camo.githubusercontent.com/8f3e065b3900eb30bc49019185197844949542bb282d088316d382d666235ce2/68747470733a2f2f706f7365722e707567782e6f72672f7468756e64657265722f73657269616c697a6172642f6c6963656e7365)](https://packagist.org/packages/thunderer/serializard)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/465289bffe9982a5818ded56346e7058656766a6196ac94bdcceb6c4a54e222f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7468756e64657265722f53657269616c697a6172642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/thunderer/Serializard/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/ba9ea3d95916fcc80c8bcdd01cc6159e842175d312b9cb51d6d9f881193b1e10/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7468756e64657265722f53657269616c697a6172642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/thunderer/Serializard/?branch=master)[![Dependency Status](https://camo.githubusercontent.com/96fae9a5e3da1e4e5ce6b9334eb09b6e206183f028397e086e224ba67edb8cd2/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3536626232616636326132396564303033343338303534362f62616467652e737667)](https://www.versioneye.com/user/projects/56bb2af62a29ed0034380546)

Serializard is a library for (un)serialization of data of any complexity. Its main focus is to give user as much flexibility as possible by delegating the (un)serialization logic to the programmer to encourage good object design and only supervising the process hiding the unpleasant details about it.

Installation
============

[](#installation)

This library is available on Composer/Packagist as `thunderer/serializard`.

Usage
=====

[](#usage)

Let's consider a simple User class with two properties and some setup code:

```
final class User
{
    private $id;
    private $name;

    public function __construct(int $id, string $name) { /* ... */ }

    public function getId() { return $this->id; }
    public function getName() { return $this->name; }
}

$user = new User(1, 'Thomas');

$formats = new FormatContainer();
$formats->add('json', new JsonFormat());

$hydrators = new FallbackHydratorContainer();
$normalizers = new FallbackNormalizerContainer();
$serializard = new Serializard($formats, $normalizers, $hydrators);
```

Serialization
-------------

[](#serialization)

Serialization is controlled by registering handlers used in normalization phase:

```
$normalizers->add(User::class, function(User $user) {
    return [
        'id' => $user->getId(),
        'name' => $user->getName(),
    ];
});

$result = $serializard->serialize($user, 'json');
// result is {"id":1,"name":"Thomas"}
```

Unserialization
---------------

[](#unserialization)

Unserialization can be controlled by registering callables able to reconstruct objects from data parsed from input text:

```
$hydrators->add(User::class, function(array $data) {
    return new User($data['id'], $data['name']);
});

$json = '{"id":1,"name":"Thomas"}';
$user = $serializard->unserialize($json, User::class, 'json');
```

Formats
=======

[](#formats)

- **JSON** in `JsonFormat` converts objects to JSON,
- **Array** in `ArrayFormat` just returns object graph normalized to arrays of scalars,
- **YAML** in `YamlFormat` converts objects to YAML (uses `symfony/yaml`),
- **XML** in `XmlFormat` converts objects to XML (uses `ext-dom`).

License
=======

[](#license)

See LICENSE file in the main directory of this library.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

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

Recently: every ~351 days

Total

8

Last Release

1949d ago

PHP version history (4 changes)v0.1.0PHP &gt;=5.3

v0.2.0PHP ^5.3|^7.0

v0.3.1PHP ^5.5|^7.0

v0.4.0PHP ^5.5|^7.0|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1087180?v=4)[Tomasz Kowalczyk](/maintainers/Thunderer)[@thunderer](https://github.com/thunderer)

---

Top Contributors

[![thunderer](https://avatars.githubusercontent.com/u/1087180?v=4)](https://github.com/thunderer "thunderer (47 commits)")

---

Tags

arrayhydrationhydratorjsonnormalizerparserphpserializationserializerxmlyamljsonnormalizerxmllibraryyamlserializerhydrator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thunderer-serializard/health.svg)

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

###  Alternatives

[phppkg/config

Config manage, load, get. Supports INI,JSON,YAML,NEON,PHP format file

133.5k](/packages/phppkg-config)

PHPackages © 2026

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