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::
473
473
$slug = $slugger->slug('10% or 5€');
474
474
// $slug = '10-percent-or-5-euro'
475
475
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
+
476
481
.. versionadded :: 5.1
477
482
478
483
The feature to define additional substitutions was introduced in Symfony 5.1.
479
484
485
+ .. versionadded :: 5.2
486
+
487
+ The feature to use a PHP closure to define substitutions was introduced in Symfony 5.2.
488
+
480
489
The separator between words is a dash (``- ``) by default, but you can define
481
490
another separator as the second argument::
482
491
You can’t perform that action at this time.
0 commit comments