mtrunkat/php-enhanced-urlgenerator

This package is abandoned and no longer maintained. No replacement package was suggested.

Url Genarater for Silex enhanced by some features.

dev-master 2014-01-22 14:33 UTC

This package is not auto-updated.

Last update: 2020-01-20 03:44:45 UTC


README

This is Symfony Url Generator class enhanced by two features:

  • It preserves given set of query parameters in every generated url.
  • It allows to generate random token for user transaction. This token is preserved in every url until the user leaves the site. It can be used for clicktracking or to track the users in simple access log.

It's boundled with Silex Service provider. It works exactly the same as the original Silex Url Generator Provider. To install Enhanced Url Generator add following line into your composer.json

"mtrunkat/php-enhanced-urlgenerator": "dev-master"

and call update/install command of composer. Then register provider to Silex:

$app->register(new \Trunkat\EnhancedUrlGeneratorProvider(), array(
    'url_generator.preserve' => array('key1', 'keyb'),
));

You can use it the same as original Silex Url Generator:

$app['url_generator']->generate('blog', array('someParam' => 'someValue'));

Resulting url will contain "key1" and "key2" as query parameters. To activate the random token feature configure provider following way:

$app->register(new \Trunkat\EnhancedUrlGeneratorProvider(), array(
    'url_generator.preserve' => array('key1', 'keyb'),
    'url_generator.token' => 'keyNameForToken',
    'url_generator.token_length' => 5,
));