PHP code example of arokettu / json5-builder

1. Go to this page and download the library: Download arokettu/json5-builder 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/ */

    

arokettu / json5-builder example snippets




use Arokettu\Json5\Json5Encoder;
use Arokettu\Json5\Values\CommentDecorator;
use Arokettu\Json5\Values\HexInteger;

r(
            new HexInteger(0xFFF),
            commentAfter: 'This is a very important value'
         ),
        'notAvailableInJSON' => [NAN, INF],
        'end' => 'auto trailing comma ->'
    ],
    commentBefore: 'This is my cool JSON5 config!',
);

echo Json5Encoder::encode($config);