A Symfony2 slugify bundle
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
DependencyInjection
Resources/config
Services
Tests/Services
Twig
.gitignore
.travis.yml
HappyRSlugifyBundle.php
README.md
build.xml
composer.json
phpunit.xml.dist

README.md

HappyR SlugifyBundle

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.

Installation

  1. Install with composer:

    php composer.phar require happyr/slugify-bundle
    
  2. Enable the bundle:

    // app/AppKernel.php
    
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new HappyR\SlugifyBundle\HappyRSlugifyBundle(),
        );
    }

Using the service


$slugifier = $this->container->get('happyr.slugify.slugifier');
$text = $slugifier->slugify('Hello World!');
echo $text; //prints "hello-world"

Using the Twig filter

{{ 'Hello World!'|slugify }} {# hello-world #}

Full Default Configuration

happy_r_slugify:
    twig: false #set to true to enable twig filter