PHP code example of sfadless / encoder

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

    

sfadless / encoder example snippets


use Sfadless\Encoder\Encryptor\Base64Encryptor;
use Sfadless\Encoder\Encoder;

$key = "someSecretString";
$encryptor = new Base64Encryptor();
$encoder = new Encoder($encryptor, $key);

$dataToEncode = "Some value that should be encoded";

$encoded = $encoder->encode($dataToEncode);
$decoded = $encoder->decode($encoded);

var_dump($dataToEncode === $decoded); //true