PHP code example of ritalin / php-json-subset-encoder

1. Go to this page and download the library: Download ritalin/php-json-subset-encoder 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/ */

    

ritalin / php-json-subset-encoder example snippets


    $meta = 
        \JsonEncoder\FilterRule::newRule()
        ->Rule::newRule()->

    // For example, object array.

    $values = [
        new NestObject('www', 10, new SomeObject('a', 'b', 'c')),
        new NestObject('xxx', 20, new SomeObject('o', 'p', 'q')),
        new NestObject('@@@', 30, new SomeObject('x', 'y', 'z'))
    ];

    $serializer = EncoderBuilder::AsObjectArray($meta)->build($values);
    

    $json = json_encode($serializer);