Symfony2 “urlize”

I have often missed the


 method from Doctrine1 in Symfony2 with Doctrine2.

Of course there’s the doctrine extensions with the sluggable behaviour, but sometimes it seems a bit overhead for smaller tasks.

I just recently discovered Behat Transliterator, which brings just the dearly missed urlize function back.

Just do

composer require behat/transliterator

As it’s an abstract class, you’ll have to create your own Helper class extending it.

And there you go:

MyTextHelper::urlize("how great is that?")