lsv / hashidsbundle
Symfony bundle for integration of hashids lib to the container
Installs: 177
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- hashids/hashids: ^1.0
- symfony/config: ^2.7|^3.0
- symfony/dependency-injection: ^2.7|^3.0
- symfony/http-kernel: ^2.7|^3.0
- symfony/twig-bridge: ^2.7|^3.0
This package is auto-updated.
Last update: 2024-10-27 22:10:15 UTC
README
Made for Symfony ^2.7 and also ^3.0
Installation
composer
composer require lsv/hashidsbundle
or add it your composer.json
"require": { "lsv/hashidsbundle": "^1.0" }
Enable bundle
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new \Lsv\HashidsBundle\LsvHashidsBundle(), ); }
Configuration
All configuration is optional, but this is the configuration availible
lsv_hashids: # Salt is default the same as your app secret salt: "%secret%" # Length is default 8 length: 8 # Alphabet is default "abcdefghij1234567890" - Default in hashids alphabet: "abcdefghij1234567890"
Usage
Controller
In your controller you can use
$this->get('lsv_hashids')->encode($id); $this->get('lsv_hashids')->decode($string);
Twig
Also added 3 twig methods
id | hashids id | encode_hashids string | decode_hashids