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.

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

v1.1.1 2013-12-11 15:33 UTC

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

  1. Install with composer:

    php composer.phar require zenstruck/slugify-bundle
    
  2. 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