PHPackages                             hail/serializer - 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. [Framework](/categories/framework)
4. /
5. hail/serializer

ActiveLibrary[Framework](/categories/framework)

hail/serializer
===============

Serialize/Unserialize PHP data

v0.8.2(5y ago)03MITPHPPHP &gt;=7.3.0

Since May 22Pushed 5y ago1 watchersCompare

[ Source](https://github.com/hail-framework/serializer)[ Packagist](https://packagist.org/packages/hail/serializer)[ Docs](http://framework.flyinghail.com/)[ RSS](/packages/hail-serializer/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Serializer
==========

[](#serializer)

Example
-------

[](#example)

```
$data = ['a' => 1, 'b' => 2];
use Hail\Serializer\Serializer;

// msgpack/igbinary/hprose/json/php/yaml
$serializer = new Serializer('msgpack');
$serialized = $serializer->encode($data);
$unserialized = $serializer->decode($serialized);

assert($data === $unserialized);

// =======================================

// serialize \Closure
$example = function ($a) {
    return $a * 2;
};
$serialized = $serializer->withClosure()->encode($example);
$unserialized = $serializer->withClosure()->decode($serialized);

assert($unserialized(2) === 4);

// =======================================

// wrapper of Hprose/Igbinary/Json/MsgPack/Serialize/Yaml
use Hail\Serializer\Json;
$json = Json::getInstance();
$serialized = $json->encode($data);
$unserialized = $json->decode($serialized);

assert($data === $unserialized);

// =======================================
assert($serializer->json === $json);
assert($serializer->json() === $json);

// =======================================
// json wrapper only
$serialized = $json
    ->withDepth(512) // default
    ->withOptions(JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) // default JSON_UNESCAPED_UNICODE
    ->encode($data);
$unserialized = $json
    ->withDepth(512) // default
    ->withOptions(JSON_OBJECT_AS_ARRAY) // default
    ->decode($serialized);

// after encode/decode depths and options will restore to default
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Total

3

Last Release

2041d ago

PHP version history (2 changes)v0.8.0PHP &gt;=7.1.3

v0.8.2PHP &gt;=7.3.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/157430?v=4)[FENG Hao](/maintainers/flyinghail)[@flyinghail](https://github.com/flyinghail)

---

Top Contributors

[![flyinghail](https://avatars.githubusercontent.com/u/157430?v=4)](https://github.com/flyinghail "flyinghail (20 commits)")

---

Tags

jsonframeworkserializeyamlserializermsgpackigbinaryHail

### Embed Badge

![Health badge](/badges/hail-serializer/health.svg)

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

###  Alternatives

[hprose/hprose

It is a modern, lightweight, cross-language, cross-platform, object-oriented, high performance, remote dynamic communication middleware. It is not only easy to use, but powerful. You just need a little time to learn, then you can use it to easily construct cross language cross platform distributed application system.

2.1k215.3k37](/packages/hprose-hprose)[lanin/laravel-api-debugger

Easily debug your JSON API.

2311.8M](/packages/lanin-laravel-api-debugger)[apix/cache

A thin PSR-6 cache wrapper with a generic interface to various caching backends emphasising cache taggging and indexing to Redis, Memcached, PDO/SQL, APC and other adapters.

114542.8k6](/packages/apix-cache)[hprose/hprose-swoole

Hprose asynchronous client &amp; standalone server based on swoole

17928.9k9](/packages/hprose-hprose-swoole)[davidepastore/slim-config

A slim middleware to read configuration from different files based on hassankhan/config

338.9k1](/packages/davidepastore-slim-config)[hprose/hprose-yii

Hprose Server for Yii 2

357.1k](/packages/hprose-hprose-yii)

PHPackages © 2026

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