I found a solution by accident here . Code:
use Gedmo\Sluggable\Util as Sluggable; $string = 'My own text!'; $slug = Sluggable\Urlizer::urlize($string, '-'); if(empty($slug)) // if $string is like '=))' or 'γγ©γ€γ’γ³γ°γ«γ»γ΅γΌγγΉ' an empty slug will be returned, that causes troubles and throws no exception echo 'error, empty slug!!!'; else echo $slug;
source share