PHP code example of buuum / encoder

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

    

buuum / encoder example snippets


$seconds = 10;
$code = $encoder->encode($data, ['delay' => $seconds]);

try{
    $data = $encoder->decode($code);
}catch(DelayException $e){
    $e->getDate(); // date active
}catch(ExpiresException $e){
    echo $e->getDate(); // date expiration
}catch (\Exception $e){
    echo $e->getMessage());
}

$data = [
    'key' => 'value',
    'key2 => 'value 2'
];
$code = $encoder->encode($data);

// encode and return always the same result
$code = $encoder->encode($data, [], false);


$seconds = 10;
$code = $encoder->encode($data, ['expires' => $seconds]);

$seconds = 10;
$code = $encoder->encode($data, ['delay' => $seconds]);