PHPackages                             json-serializer/json-serializer-php8 - 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. json-serializer/json-serializer-php8

ActiveLibrary

json-serializer/json-serializer-php8
====================================

General de/serializer for vatious serialization formats.

v1.0.1(1y ago)03MITPHPPHP ^8.2

Since Dec 16Pushed 1y agoCompare

[ Source](https://github.com/svetborisov/JSONserializerPHP8)[ Packagist](https://packagist.org/packages/json-serializer/json-serializer-php8)[ RSS](/packages/json-serializer-json-serializer-php8/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (22)Versions (3)Used By (0)

BetterSerializer (PHP)
======================

[](#betterserializer-php)

[![Build Status](https://camo.githubusercontent.com/3a1ebbc7d842cdbc4990cc8dafa17c764d8c0f84f6fd07030662bd4bd012a19d/68747470733a2f2f7472617669732d63692e6f72672f6265747465722d73657269616c697a65722f6265747465722d73657269616c697a65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/better-serializer/better-serializer)[![Coverage Status](https://camo.githubusercontent.com/5820f2581d1288a5dc6f43bc13d9cee599b2d5198dcaff7dccdffb461794ab68/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6265747465722d73657269616c697a65722f6265747465722d73657269616c697a65722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/better-serializer/better-serializer?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/124e088c3e96619db5664fca809eddeec7e89882efea787a6b0b2305c3b61d8b/68747470733a2f2f706f7365722e707567782e6f72672f6265747465722d73657269616c697a65722f6265747465722d73657269616c697a65722f76657273696f6e)](https://packagist.org/packages/better-serializer/better-serializer)[![Total Downloads](https://camo.githubusercontent.com/cd3c0fd0b4a5742616b0539e80a77716b6e41d2eafbef31bdefdd92f6e0f1bbb/68747470733a2f2f706f7365722e707567782e6f72672f6265747465722d73657269616c697a65722f6265747465722d73657269616c697a65722f646f776e6c6f616473)](https://packagist.org/packages/better-serializer/better-serializer)[![Latest Unstable Version](https://camo.githubusercontent.com/38bff5d6eb5c289084809b6db27d75d690537db4ac660fb8425dd7b2473deac7/68747470733a2f2f706f7365722e707567782e6f72672f6265747465722d73657269616c697a65722f6265747465722d73657269616c697a65722f762f756e737461626c65)](//packagist.org/packages/better-serializer/better-serializer)[![License](https://camo.githubusercontent.com/8b1ccd2233eae6289192e6e9d16cbbdcff3e15f964e4043090167c1cb314b0cc/68747470733a2f2f706f7365722e707567782e6f72672f6265747465722d73657269616c697a65722f6265747465722d73657269616c697a65722f6c6963656e7365)](https://packagist.org/packages/better-serializer/better-serializer)[![composer.lock available](https://camo.githubusercontent.com/697c3d91fda287e6f1dd4c74aee3f2b4cf288dffadb006436bc1f268506bbe0d/68747470733a2f2f706f7365722e707567782e6f72672f6265747465722d73657269616c697a65722f6265747465722d73657269616c697a65722f636f6d706f7365726c6f636b)](https://packagist.org/packages/better-serializer/better-serializer)[![Appveyor status](https://camo.githubusercontent.com/ae143903514572d0740d5d66ec61ac3a42657d7d451f6fea7f635d413a409b2c/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f6769746875622f6265747465722d73657269616c697a65722f6265747465722d73657269616c697a65723f7376673d74727565)](https://ci.appveyor.com/api/projects/status/github/better-serializer/better-serializer)

This library provides a general serializer for PHP. Currently only JSON serialization format is supported. The project aims to be an alternative to [JmsSerializer](https://github.com/schmittjoh/serializer). It tries to be faster then JmsSerializer and it also tries to sustain a better maintainable and understandable code base. Also, as this is also a learning experiment, one of the goals is to have unit tests with 100% code coverage.

Except the above mentioned goals, the project also aims to provide some cool features - it tries to combine the best features from JmsSerializer and from [Jackson](https://github.com/FasterXML/jackson) in Java.

Installation
------------

[](#installation)

composer require json-serializer/json-serializer-php8

Current state
-------------

[](#current-state)

Currently, only JSON de/serialization is implemented. It's possible to de/serialize complex nested data structures (objects and arrays). Only arrays are supported as collection types for now.

Performance
-----------

[](#performance)

For now the code is only a proof of concept, but it is stabilizing more and more each day. It already yields interesting results. Without implementing metadata caching, the serialization process is already [4-6x faster](tests/Performance/Serialization/JsonTest.php) than using JmsSerializer. The deserialization process is also faster, but only [cca 3.5x faster](tests/Performance/Deserialization/JsonTest.php).

There is also another benchmark, which compares JMS Serializer, [Ivory Serializer](https://github.com/egeloen/ivory-serializer) and Better Serialier. It also integrates Symfony serializer, but I needed to comment it out, because it was 100-300x slower than Better Serializer. You can find a fork of it [here](https://github.com/better-serializer/ivory-serializer-benchmark) and try it on your own. For best results, please disable XDebug while running the tests.

Here are some of the results:

```
$ php bin/benchmark  --iteration 1000 --horizontal-complexity 2 --vertical-complexity 2
Ivory: Done!
JMS: Done!
BetterSerializer: Done!

+------------------+----------------+--------+
| Serializer       | Duration (sec) | Factor |
+------------------+----------------+--------+
| BetterSerializer | 0.001188s      | 1.00x  |
| Ivory            | 0.002222s      | 1.87x  |
| JMS              | 0.002901s      | 2.44x  |
+------------------+----------------+--------+

$ php bin/benchmark  --iteration 100 --horizontal-complexity 10 --vertical-complexity 10
Ivory: Done!
JMS: Done!
BetterSerializer: Done!

+------------------+----------------+--------+
| Serializer       | Duration (sec) | Factor |
+------------------+----------------+--------+
| BetterSerializer | 0.011377s      | 1.00x  |
| Ivory            | 0.037377s      | 3.29x  |
| JMS              | 0.046837s      | 4.12x  |
+------------------+----------------+--------+

$ php bin/benchmark  --iteration 1 --horizontal-complexity 100 --vertical-complexity 200
Ivory: Done!
JMS: Done!
BetterSerializer: Done!

+------------------+----------------+--------+
| Serializer       | Duration (sec) | Factor |
+------------------+----------------+--------+
| BetterSerializer | 1.040695s      | 1.00x  |
| Ivory            | 4.191479s      | 4.03x  |
| JMS              | 4.466160s      | 4.29x  |
+------------------+----------------+--------+

$ php bin/benchmark  --iteration 1 --horizontal-complexity 200 --vertical-complexity 200
Ivory: Done!
JMS: Done!
BetterSerializer: Done!

+------------------+----------------+--------+
| Serializer       | Duration (sec) | Factor |
+------------------+----------------+--------+
| BetterSerializer | 4.523851s      | 1.00x  |
| Ivory            | 15.580491s     | 3.44x  |
| JMS              | 18.571867s     | 4.11x  |
+------------------+----------------+--------+
```

**This means that you can now effectively de/serialize 4x more entities (e.g. in API results) using the same amount of time than before!**

Regarding the performance gains - I'd like someone to check the measured values, since the results seem quite great and I'm suspicious myself :).

Features
--------

[](#features)

You can check out the features in the [features page](doc/Features.md). Please also check the supported [annotations documentation](doc/Annotations.md).

Requirements
------------

[](#requirements)

This library requires PHP 7.2 and it won't work with older versions. Older versions won't be supported.

Usage
-----

[](#usage)

The usage is described [here](doc/Usage.md).

The de/serializaton annotations are described [here](doc/Annotations.md).

If you'd like to write custom extensions for special de/serialising of selected data types, check the [extensions section](doc/Extensions.md)

Future Plans
------------

[](#future-plans)

- metadata caching
- XML and YAML support
- various collection classes support (Doctrine collections, internal PHP collections like SplStack)
- data injection using class constructors (internal and static), which should improve performance even more
- various features import from JmsSerializer and Jackson
- framework integrations

**Contributions are welcome! :)**

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.3% 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 ~0 days

Total

2

Last Release

518d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0dd09412bcb0c72294f71c57ce73658c664c7da74bf26171805f9456e2bed685?d=identicon)[svetborisov](/maintainers/svetborisov)

---

Top Contributors

[![Rastusik](https://avatars.githubusercontent.com/u/1735097?v=4)](https://github.com/Rastusik "Rastusik (158 commits)")[![svetborisov](https://avatars.githubusercontent.com/u/73840812?v=4)](https://github.com/svetborisov "svetborisov (5 commits)")[![eduardor2k](https://avatars.githubusercontent.com/u/318278?v=4)](https://github.com/eduardor2k "eduardor2k (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[akeneo/pim-community-dev

Akeneo PIM, the future of catalog management is open!

1.0k614.1k81](/packages/akeneo-pim-community-dev)[shopware/shopware

Shopware 5 is an open source e-commerce software made in Germany

1.3k746.6k35](/packages/shopware-shopware)[forkcms/forkcms

Fork is an open source CMS that will rock your world.

1.2k44.5k](/packages/forkcms-forkcms)[oat-sa/tao-core

TAO core extension

66136.7k74](/packages/oat-sa-tao-core)[shopsys/framework

Core of Shopsys Platform - open source framework for building large, scalable, fast-growing e-commerce projects based on Symfony

25211.4k19](/packages/shopsys-framework)

PHPackages © 2026

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