Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

A Silex Service Provider for the Optimus ID transformation library

Notifications You must be signed in to change notification settings

letsjaam/silex-optimus-provider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Optimus Silex Service Provider

This library provides a Optimus service for the Silex framework.

Installation

composer require jaam/silex-optimus-provider

Usage

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);

Twig Extension

If the twig service is available, the service provider adds an extension enabling a Twig filter to use in your templates.

{{ my_id|optimus }}

Services

The provider exposes a optimus service. Please see the Optimus documentation for full usage.

About

A Silex Service Provider for the Optimus ID transformation library

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages