Package for managing multi-step encoding and decoding of strings/objects.
use o6web\MultiEncoder\Encoder;
use o6web\MultiEncoder\Step;
// Define the encoding steps
$encode = [
// Steps can be existing functions or callable
new Step('strrev'),
new Step('base64_encode'),
];
// Define the decoding steps
$decode = [
new Step('base64_decode'),
new Step('strrev'),
];
$multiEncoder = new Translator($encode, $decode);
$data = 'This is a string';
$encoded_data = $multiEncoder->encode($data); // Z25pcnRzIGEgc2kgc2loVA==
$decoded_data = $multiEncoder->decode($encoded_data); // This is a string- Add a dependency on o6web/multiencoder to your composer.json file if you use Composer to manage the dependencies of your project:
composer require o6web/multiencoderAlthough it's recommended to use Composer, you can actually include the file(s) any way you want.
MultiEncoder is MIT licensed.