dev-master
9999999-dev https://github.com/jlaso/JaitecAliasBundleA simple alias generator
MIT
id jaitec
Wallogit.com
2017 © Pedro Peláez
A simple alias generator
This bundle provides helpers to generate pseudo-random alias., (*1)
::, (*3)
$ git submodule add git://github.com/jlaso/JaitecAliasBundle.git vendor/bundles/Jaitec/AliasBundle
or add this to deps, (*4)
[JaitecAliasBundle]
git=http://github.com/jlaso/JaitecAliasBundle
target=/bundles/Jaitec/AliasBundle
and run, (*5)
$ php bin/vendors install
::, (*6)
// app/autoload.php
$loader->registerNamespaces(array(
'Jaitec' => __DIR__.'/../vendor/bundles',
// your other namespaces
);
::, (*7)
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Jaitec\AliasBundle\JaitecAliasBundle(),
// ...
);
}
AliasBundle provides this service to generate pseudo-random alias :, (*8)
jaitec_alias.main implements AliasGeneratorInterface
Instead of those specialized services, you can also inject jaitec_alias.main,
which provides shortcuts to all of the other services and allow you to only
inject a single dependancy., (*9)
For example generating alias for an url based on row ID in mysql table, (*10)
First get the object throught dependency inject, (*11)
$this->alias = $this->container->get('jaitec_alias.main');
Now generate the alias, (*12)
$alias = $this->alias->encode($record->getId(),4);
A simple alias generator
MIT
id jaitec