PHP code example of monsieurbon / json-serializer

1. Go to this page and download the library: Download monsieurbon/json-serializer 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/ */

    

monsieurbon / json-serializer example snippets


$serializer = new JsonSerializer();
$serializer->configure('path/to/some/config.yml');

$json = $serializer->serialize($myObject);
$myObject = $serializer->deserialize($json, MyClass::class);
$myObject = $serializer->deserialize($json, function ($dataArray) {
    return 'My\ClassName\From\DataArray';
});