PHP code example of spomky-labs / cbor-bundle

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

    

spomky-labs / cbor-bundle example snippets




use SpomkyLabs\CborBundle\CBORDecoder;

// CBOR object (shall be a binary string; in hex for the example)
$data = hex2bin('fb3fd5555555555555');

// Load the data
$object = $container->get(CBORDecoder::class)->decode($data); // Return a CBOR\OtherObject\DoublePrecisionFloatObject class with normalized value ~0.3333 (=1/3)