File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -473,10 +473,19 @@ that only includes safe ASCII characters::
473473 $slug = $slugger->slug('10% or 5€');
474474 // $slug = '10-percent-or-5-euro'
475475
476+ // for more dynamic substitutions, pass a PHP closure instead of an array
477+ $slugger = new AsciiSlugger('en', function ($string, $locale) {
478+ return str_replace('❤️', 'love', $string);
479+ });
480+
476481.. versionadded :: 5.1
477482
478483 The feature to define additional substitutions was introduced in Symfony 5.1.
479484
485+ .. versionadded :: 5.2
486+
487+ The feature to use a PHP closure to define substitutions was introduced in Symfony 5.2.
488+
480489The separator between words is a dash (``- ``) by default, but you can define
481490another separator as the second argument::
482491
You can’t perform that action at this time.
0 commit comments