PHPackages                             h4kuna/serialize-polyfill - 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. h4kuna/serialize-polyfill

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

h4kuna/serialize-polyfill
=========================

Provide methods for serialization and use igbinary if is available.

v0.2.5(1y ago)221.0k↓50%2MITPHPCI passing

Since Aug 23Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (12)Used By (2)

Serialization
=============

[](#serialization)

[![Downloads this Month](https://camo.githubusercontent.com/581753cc40e857528f30d6eb07ef72f8a1e46d191ae97c06240fd217c62e1dbd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f68346b756e612f73657269616c697a652d706f6c7966696c6c2e737667)](https://packagist.org/packages/h4kuna/serialize-polyfill)[![Latest stable](https://camo.githubusercontent.com/5c0f2425017e9c09c10121d629e14739ec177d3a18629ba01cc93b83eb92c60d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68346b756e612f73657269616c697a652d706f6c7966696c6c2e737667)](https://packagist.org/packages/h4kuna/serialize-polyfill)

In your project are available two new methods.

- h4kuna\\Serialize\\Serialize::encode()
- h4kuna\\Serialize\\Serialize::decode()

If you enable igbinary extension, then automatic use Driver\\IgBinary. Or you can define own implmentation by Driver interface.

Example why use Serialize class
-------------------------------

[](#example-why-use-serialize-class)

In many use cases is igbinary faster. Anybody use in third party library h4kuna\\Serialize\\Serialize::encode/decode. If you enable igbinary and for this third party case you want to disable and to use standard serialization. See example.

External library in vendor

```
namespace Com\Example;

use h4kuna\Serialize\Serialize;

class Foo implements \Serializable {
    public function serialize(): ?string {
        return Serialize::encode($this, __CLASS__);
    }

    public function unserialize(string $data): void {
        Serialize::decode($data, __CLASS__);
        // do anything
    }
}
```

Enable standard serialization for class above.

```
use h4kuna\Serialize\Driver;
use h4kuna\Serialize\Serialize;

require_once __DIR__ . '/vendor/autoload.php';
Serialize::setUp(Driver\IgBinary::class, [
    Com\Example\Foo::class => Driver\Php::class // only for Com\Example\Foo use case
]);
```

Compatibility
-------------

[](#compatibility)

You are using php serialize and you want to use igbinary. You can enable igbinaty on fly and old serialized data will be decoded by old php serialize.

> Support compatibility, if you have serialized data by php serialize, then you can decode by IgBinary::decode() and vice versa.

Enable igbinary
---------------

[](#enable-igbinary)

1. Install igbinary extension
2.

```
require __DIR__ . '/vendor/autoload.php';
\h4kuna\Serialize\Serialize::setUp(IgBinary::class);
```

Works!

Disable igbinary
----------------

[](#disable-igbinary)

1. set Php driver after vendor/autoload.php

```
require __DIR__ . '/vendor/autoload.php';
// \h4kuna\Serialize\Serialize::setUp(IgBinary::class); remove
```

2. wait if your all data will be decoded
3. uninstall igbinary extension

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance40

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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

Recently: every ~147 days

Total

10

Last Release

647d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/54b4efb9b89167fa3598b1a41477b20387390f4a0fb65b447bd6bb7c30a49020?d=identicon)[h4kuna](/maintainers/h4kuna)

---

Top Contributors

[![h4kuna](https://avatars.githubusercontent.com/u/335722?v=4)](https://github.com/h4kuna "h4kuna (15 commits)")

---

Tags

igbinaryphpserialize

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/h4kuna-serialize-polyfill/health.svg)

```
[![Health](https://phpackages.com/badges/h4kuna-serialize-polyfill/health.svg)](https://phpackages.com/packages/h4kuna-serialize-polyfill)
```

###  Alternatives

[nette/php-generator

🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 8.5 features.

2.2k64.2M574](/packages/nette-php-generator)[nette/robot-loader

🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.

89152.7M320](/packages/nette-robot-loader)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M81](/packages/symplify-monorepo-builder)[nette/component-model

⚛ Nette Component Model

28516.5M90](/packages/nette-component-model)[nette/code-checker

✅ Nette CodeChecker: A simple tool to check source code against a set of Nette coding standards.

881.7M6](/packages/nette-code-checker)[contributte/di

Extra contrib to nette/di

465.8M18](/packages/contributte-di)

PHPackages © 2026

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