2017 © Pedro Peláez
 

symfony-bundle hashidsbundle

Symfony bundle for integration of hashids lib to the container

image

lsv/hashidsbundle

Symfony bundle for integration of hashids lib to the container

  • Thursday, May 12, 2016
  • by lsv
  • Repository
  • 1 Watchers
  • 1 Stars
  • 152 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

Symfony hashids bundle

Made for Symfony ^2.7 and also ^3.0, (*1)

Installation

composer
composer require lsv/hashidsbundle

or add it your composer.json, (*2)

"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, (*3)

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, (*4)

$this->get('lsv_hashids')->encode($id);
$this->get('lsv_hashids')->decode($string);
Twig

Also added 3 twig methods, (*5)

id | hashids
id | encode_hashids
string | decode_hashids

The Versions

12/05 2016

dev-master

9999999-dev

Symfony bundle for integration of hashids lib to the container

  Sources   Download

MIT

The Requires

 

hashids

12/05 2016
12/05 2016
12/05 2016

1.0.0

1.0.0.0

Symfony bundle for integration of hashids lib to the container

  Sources   Download

MIT

The Requires

 

The Development Requires

hashids