PHP code example of docteurklein / json-chunks

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

    

docteurklein / json-chunks example snippets


$chunks = DocteurKlein\JsonChunks\Encode::from([
    '_links' => [
        'product' => function() {
            yield from [1, 2, 3];
        },
    ],
    '_embedded' => [
        'product' => function() {
            yield from [
                1,
                2,
                function() {
                    yield from [3];
                }
            ];
        },
    ],
]);

foreach ($chunks as $chunk) {
    echo $chunk;
}