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

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

swoft/serialize
===============

simple data serializer tool library of the php

v2.0.1(6y ago)237.0k—0%24Apache-2.0PHPPHP &gt;7.1.0

Since Apr 12Pushed 6y ago2 watchersCompare

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

READMEChangelogDependencies (1)Versions (5)Used By (4)

Data Serialize
==============

[](#data-serialize)

[![Latest Stable Version](https://camo.githubusercontent.com/ac2e7c1ea1238a8a5f7d90ff3454c9216dc2d1a0e1a799e4deda886fe9b0e1e8/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73776f66742f73657269616c697a652e737667)](https://packagist.org/packages/swoft/serialize)[![Php Version](https://camo.githubusercontent.com/c197ef1e57a32c886b2a54d02ead7dbc035f18b3f39a642703b9372eef7819f9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e312d627269676874677265656e2e7376673f6d61784167653d32353932303030)](https://secure.php.net/)[![Library License](https://camo.githubusercontent.com/1c419f89412ea6c234c184ad6d85decb127c18584858d3707ae7d8e2131eccc4/68747470733a2f2f696d672e736869656c64732e696f2f686578706d2f6c2f706c75672e7376673f6d61784167653d32353932303030)](https://github.com/swoft-cloud/swoft-serialize/blob/master/LICENSE)[![Actions Status](https://github.com/swoft-cloud/swoft-serialize/workflows/Unit-tests/badge.svg)](https://github.com/swoft-cloud/swoft-serialize/actions)

Universal data serializer for PHP

Serializers:

- json(by `json_encode`)
- php(by `serialize`)
- igbinary(by extension `igbinary`)
- msgpack(by extension `msgpack`)

Install
-------

[](#install)

- composer command

```
composer require swoft/serialize
```

Usage
-----

[](#usage)

```
$serializer = new JsonSerializer();
// $serializer = new PhpSerializer();
// $serializer = new IgBinarySerializer();
// $serializer = new MsgPackSerializer();

// serialize data
$string = $serializer->serialize($data);

// unserialize string
$data = $serializer->unserialize($string);
```

Unit testing
------------

[](#unit-testing)

```
phpunit
```

LICENSE
-------

[](#license)

The Component is open-sourced software licensed under the [Apache license](LICENSE).

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 96.2% 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 ~199 days

Total

4

Last Release

2350d ago

Major Versions

v1.0.1 → v2.0.02019-11-11

PHP version history (2 changes)1.x-devPHP &gt;7.0.0

v2.0.0PHP &gt;7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b2523931b3da00b736f7228ef9523aec5300b7ebead79a1460256cfc1a913fe5?d=identicon)[swoft](/maintainers/swoft)

---

Top Contributors

[![inhere](https://avatars.githubusercontent.com/u/5302062?v=4)](https://github.com/inhere "inhere (25 commits)")[![huangzhhui](https://avatars.githubusercontent.com/u/12077148?v=4)](https://github.com/huangzhhui "huangzhhui (1 commits)")

---

Tags

php-libraryserializationswoft-componentphplibrarytool

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[bupy7/xml-constructor

The array-like constructor of XML document structure.

1337.9k](/packages/bupy7-xml-constructor)[leonelquinteros/php-toml

PHP parser for TOML language ( https://github.com/toml-lang/toml )

266.7k](/packages/leonelquinteros-php-toml)[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)
