This bundle provides integration of the URLify library into Symfony2. A slugify service and twig filter is provided. This bundle is a modified version of the ZenstruckSlugifyBundle. The ZenstruckSlugifyBundle uses the Slugify library.
-
Install with composer:
php composer.phar require happyr/slugify-bundle
-
Enable the bundle:
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new HappyR\SlugifyBundle\HappyRSlugifyBundle(), ); }
$slugifier = $this->container->get('happyr.slugify.slugifier');
$text = $slugifier->slugify('Hello World!');
echo $text; //prints "hello-world"
{{ 'Hello World!'|slugify }} {# hello-world #}
happy_r_slugify:
twig: false #set to true to enable twig filter