PHPackages                             ayeo/pinkman - 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. ayeo/pinkman

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

ayeo/pinkman
============

Simple serialization/deserialization util

0.1.1(4y ago)32.3k↓100%1[1 PRs](https://github.com/ayeo/pinkman/pulls)MITPHPPHP &gt;=8.0CI passing

Since Nov 7Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/ayeo/pinkman)[ Packagist](https://packagist.org/packages/ayeo/pinkman)[ RSS](/packages/ayeo-pinkman/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (6)Used By (0)

Pinkman is safe serialization/deserialization utilility with dead simple config
===============================================================================

[](#pinkman-is-safe-serializationdeserialization-utilility-with-dead-simple-config)

[![Build Status](https://camo.githubusercontent.com/9c8afc2a9cb499b5432919108509823ccf9c1365601a4aa87049d2a7823e26a2/68747470733a2f2f7472617669732d63692e6f72672f6179656f2f70696e6b6d616e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ayeo/pinkman)[![Coverage](https://camo.githubusercontent.com/b8e1eb3a8318246ef4c4fdb7374f65b9da1964ef736ff92937d968e3a976bbd1/68747470733a2f2f636f6465636f762e696f2f67682f6179656f2f70696e6b6d616e2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/ayeo/pinkman)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](license.md)

Notice: Pinkman is still not at stable stage yet. Use carefully.

Pinkman is super happy to convert any object to an array for you. It also here to reconsistute the object from pure array data. At my company we happily use Pinkman to help us store our aggregates into the database. In case you struggle with CQRS approachat your side you may find him usefull as well. Think of Pinkman as of your personal laboratory assistant. He can't wait to help you rule the world tonignt.

Motivation
----------

[](#motivation)

Build-in php serialize/unserialize functions works fine until you are not about to change your objects. Then it becomes impossibne to unserialize prevoisly serialized object. I have found few similar tools on github but wasn't happy with any mainly because of heavy config.

Install
-------

[](#install)

```
composer require ayeo/pinkman:0.1.0

```

Core features
-------------

[](#core-features)

- working with privete/proteced properties
- handling nested objects
- handling recurrent nesting
- handling nested arrays/collectoins

The simplest possible scenario example
--------------------------------------

[](#the-simplest-possible-scenario-example)

### Serialization

[](#serialization)

Consider the simple flat object to get the point:

```
class Address
{
    private $street;
    private $buildingNumber;
    private $apartamentNumber;
    private $postalCode;
    private $town;

    public function __construct(
        string $street,
        string $buildingNumber,
        string $apartamentNumver,
        string $postalCode,
        string $town,
        string $countryCode
    ) {
        //...
    }
}
```

Converting to an array is straitforward

```
use Ayeo/Pinkman/Pinkaman;

$address = new Address('Thomas Edisson Av', '34a', '11', 'NG10-32Q', 'Nottingham', 'UK');
$pinkman = new Pinkman()
$pureData = $pinkman->distill($address);
```

Data array looks like this:

```
$pureData = [
    'street' => 'Thomas Edisson Av',
    'buildingNumber' => '34a',
    'apartamentNumber' => '11',
    'postalCode' => 'NG10-34Q',
    'town' => 'Nottingham',
    'countryCode' => 'UK'
];
```

It is nothing more than mapping object structure to an array. But is start shinning with more complex structures.

### Deserialization

[](#deserialization)

As you have probably noticed the output data is an array consisting of raw data. To reconstitute living object you need to provide adequate config. In our simple scenario looks like this:

```
$config = [
    'class' => Address::class
];
$object = $pinkman->hydrate($pureData, $config);
```

More elaborate and complex examples are comming your way

###  Health Score

41

↑

FairBetter than 89% of packages

Maintenance59

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.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 ~742 days

Total

2

Last Release

1587d ago

PHP version history (2 changes)0.1.0PHP ^7.2

0.1.1PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e19f24a709e451d9017d8748a8f42a03a3974a9ab065aeda950ec96b229d7f4?d=identicon)[ayeo](/maintainers/ayeo)

---

Top Contributors

[![ayeo](https://avatars.githubusercontent.com/u/60191?v=4)](https://github.com/ayeo "ayeo (6 commits)")[![wa51ol](https://avatars.githubusercontent.com/u/1472782?v=4)](https://github.com/wa51ol "wa51ol (1 commits)")

---

Tags

serializeserializerdeserializer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ayeo-pinkman/health.svg)

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

###  Alternatives

[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k228.5M255](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k234.7M194](/packages/masterminds-html5)[zumba/json-serializer

Serialize PHP variables, including objects, in JSON format. Support to unserialize it too.

124731.8k12](/packages/zumba-json-serializer)[goetas-webservices/xsd2php-runtime

Convert XSD (XML Schema) definitions into PHP classes

4910.3M31](/packages/goetas-webservices-xsd2php-runtime)

PHPackages © 2026

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