zenstruck / slugify-bundle
Provides a slugify service and twig filter for Symfony2.
Fund package maintenance!
kbond
Installs: 44 020
Dependents: 1
Suggesters: 3
Security: 0
Stars: 7
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
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