zenstruck / slugify-bundle
This package is abandoned and no longer maintained.
The author suggests using the cocur/slugify package instead.
Provides a slugify service and twig filter for Symfony2.
Package info
github.com/kbond/ZenstruckSlugifyBundle
Type:symfony-bundle
pkg:composer/zenstruck/slugify-bundle
Fund package maintenance!
v1.1.1
2013-12-11 15:33 UTC
Requires
- cocur/slugify: ~0.2
- symfony/symfony: ~2.1
This package is not auto-updated.
Last update: 2022-02-01 12:24:34 UTC
README
DEPRECATED in favor of cocur/slugify which now includes a Symfony2 Bundle
This bundle provides integration of the Slugify library into Symfony2. A slugify service and twig filter is provided.
Installation
-
Install with composer:
php composer.phar require zenstruck/slugify-bundle -
Enable the bundle:
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Zenstruck\SlugifyBundle\ZenstruckSlugifyBundle() ); }
Using the service
/** @var Cocur\Slugify\Slugify $slugify */ $slugify = $this->container->get('zenstruck.slugify');
Using the Twig filter
{{ 'Hello World!'|slugify }} {# hello-world #}
{# custom space separator #}
{{ 'Hello World!'|slugify('_') }} {# hello_world #}
{# custom space separator and custom replacement for emptyValue #}
{{ '####'|slugify('_', 'non') }} {# non #}
Full Default Configuration
zenstruck_slugify: twig: true #enable twig filter mode: array #iconv or array mode