Skip to content
This repository has been archived by the owner on May 15, 2020. It is now read-only.

v1.0.0 Package "reversible" created

Latest
Compare
Choose a tag to compare
@vertexvaar vertexvaar released this 12 Feb 18:24
· 3 commits to master since this release
8b76049

Reversible functions are functions that can be undone. In this packages they are implemented using closures. Closures are versatile, highly portable yet small in size.
This package provides some reversible functions, currently only for encoding:

  • php serialization
  • json encoding
  • base64 encoding
  • url and raw url encoding

Also a queue is shipped with this version.
You can create a queue and use it for multi-step encoding.
Example: Serialize an object and encode in base64 for safe transport

// Build the queue
$reversibleQueue = new \CoStack\Reversible\ReversibleQueue();
$reversibleQueue->enqueue(new \CoStack\Reversible\Encoding\SerializationEncoding());
$reversibleQueue->enqueue(new \CoStack\Reversible\Encoding\Base64Encoding());

$output = $reversibleQueue->getExecutionClosure()($input);

// Transport

$input = $reversibleQueue->getReversionClosure()($output);