sfadless/encoder

Encodes and decodes values by key

1.0 2019-10-21 15:18 UTC

This package is auto-updated.

Last update: 2024-10-19 18:16:15 UTC


README

Encodes and decodes string values

Documentation

Usage

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