PHP code example of json-serializer / json-serializer-php8
1. Go to this page and download the library: Download json-serializer/json-serializer-php8 library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
json-serializer / json-serializer-php8 example snippets
bash
$ 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 |
+------------------+----------------+--------+