Download the PHP package json-serializer/json-serializer-php8 without Composer
On this page you can find all versions of the php package json-serializer/json-serializer-php8. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download json-serializer/json-serializer-php8
More information about json-serializer/json-serializer-php8
Files in json-serializer/json-serializer-php8
Package json-serializer-php8
Short Description General de/serializer for vatious serialization formats.
License MIT
Informations about the package json-serializer-php8
BetterSerializer (PHP)
This library provides a general serializer for PHP. Currently only JSON serialization format is supported. The project aims to be an alternative to JmsSerializer. 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 in Java.
Installation
composer require json-serializer/json-serializer-php8
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
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 than using JmsSerializer. The deserialization process is also faster, but only cca 3.5x faster.
There is also another benchmark, which compares JMS Serializer, 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 and try it on your own. For best results, please disable XDebug while running the tests.
Here are some of the results:
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
You can check out the features in the features page. Please also check the supported annotations documentation.
Requirements
This library requires PHP 7.2 and it won't work with older versions. Older versions won't be supported.
Usage
The usage is described here.
The de/serializaton annotations are described here.
If you'd like to write custom extensions for special de/serialising of selected data types, check the extensions section
Future Plans
metadata caching- XML and YAML support
- various collection classes support (
Doctrine collections, internal PHP collections like SplStack) - data injection using class constructors (
internaland static), which should improve performance even more - various features import from JmsSerializer and Jackson
- framework integrations
Contributions are welcome! :)
All versions of json-serializer-php8 with dependencies
doctrine/annotations Version ^1.3
doctrine/cache Version ^v1.7
doctrine/instantiator Version ^1.0
league/flysystem Version ^1.0
marc-mabe/php-enum Version ^2.3
phpdocumentor/reflection-docblock Version ^5.6.1
pimple/pimple Version ^3.0