Small Twig Slug Generator
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Twig Slug Generator

GitHub issues GitHub forks GitHub license

A Twig extension for abr4xas/twig-slug.

how to install

$ composer require abr4xas/twig-slug
$ composer dumpautoload -o // optional

or add this to your composer.json

    "require": {
        "abr4xas/twig-slug": "dev-master"


$ composer update
$ composer dumpautoload -o // optional


First register the extension with Twig:

$twig = new Twig_Environment($loader);
$twig->addExtension(new \SeoUrl\SeoUrl());

then use it in your templates:

{{ This is an awesome string | seourl }} // output: this-is-an-awesome-string

in SomeController like this:


namespace SomeNameSpace;

use SeoUrl\SeoUrl;

class SomeController
    public function someFunction()
        $str = 'This is an awesome string';

        $seoUrl = SeoUrl::generateSlug($str); // output: this-is-an-awesome-string