This library provides a Optimus service for the Silex framework.
composer require jaam/silex-optimus-provider
Full documentartion of the Optimus library can be found in its repository: https://github.com/jenssegers/optimus
Firstly, generate your Prime, Inverse Prime and Random values.
php vendor/bin/optimus spark
Feed these values into the container.
use Jaam\Silex\Provider\OptimusServiceProvider;
$app->register(new OptimusServiceProvider, [
'optimus.options' => [
'prime' => YOUR_PRIME
'inverse' => YOUR_INVERSE
'random' => YOUR_RANDOM
]
]);
$hashId = $app['optimus']->encode($myId);
$myId = $app['optimus']->decode($hashId);
If the twig
service is available, the service provider adds an extension enabling a Twig filter to use in your templates.
{{ my_id|optimus }}
The provider exposes a optimus
service. Please see the Optimus documentation for full usage.