PHP code example of firehed / cbor

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

    

firehed / cbor example snippets


$decoder = new Firehed\CBOR\Decoder();

$binaryString = "\x18\x64"; // CBOR for int(100)
$data = $decoder->decode($binaryString);

// OR
$byteArray = [24, 100];
$data = $decoder->decodeArrayOfBytes($byteArray);