PHP code example of schorschii / fastinfoset

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

    

schorschii / fastinfoset example snippets




$encoder = new FastInfoset\Encoder();
$binary = $encoder->encode(file_get_contents('document.xml'));
file_put_contents('document.fi', $binary);

$decoder = new FastInfoset\Decoder();
$xml = $decoder->decode(file_get_contents('document.fi'));
file_put_contents('document.xml', $xml);

$encoder = new FastInfoset\Encoder(
    maxDepth: 256,
    maxOutputBytes: 64 * 1024 * 1024,
    maxTableEntries: 1_048_576, // Per vocabulary table; also capped by the format.
    maxIndexedStringBytes: 64, // Set to zero to disable value/text indexing.
);

$decoder = new FastInfoset\Decoder(
    maxDepth: 256,
    maxOutputBytes: 64 * 1024 * 1024,
    maxTableEntries: 1_048_576, // Per vocabulary table.
);
sh
php tests/run.php
composer test