File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -810,13 +810,14 @@ random order.
810
810
s('fòôbàř')->shuffle(); // 'àôřbòf'
811
811
```
812
812
813
- ##### slugify([ , string $replacement = '-' ] )
813
+ ##### slugify([ , string $replacement = '-' [ , string $language = 'en' ] ] )
814
814
815
815
Converts the string into an URL slug. This includes replacing non-ASCII
816
816
characters with their closest ASCII equivalents, removing remaining
817
817
non-ASCII and non-alphanumeric characters, and replacing whitespace with
818
818
$replacement. The replacement defaults to a single dash, and the string
819
- is also converted to lowercase.
819
+ is also converted to lowercase. The language of the source string can
820
+ also be supplied for language-specific transliteration.
820
821
821
822
``` php
822
823
s('Using strings like fòô bàř')->slugify(); // 'using-strings-like-foo-bar'
Original file line number Diff line number Diff line change @@ -1157,14 +1157,16 @@ public function shuffle()
1157
1157
* characters with their closest ASCII equivalents, removing remaining
1158
1158
* non-ASCII and non-alphanumeric characters, and replacing whitespace with
1159
1159
* $replacement. The replacement defaults to a single dash, and the string
1160
- * is also converted to lowercase.
1160
+ * is also converted to lowercase. The language of the source string can
1161
+ * also be supplied for language-specific transliteration.
1161
1162
*
1162
1163
* @param string $replacement The string used to replace whitespace
1164
+ * @param string $language Language of the source string
1163
1165
* @return static Object whose $str has been converted to an URL slug
1164
1166
*/
1165
- public function slugify ($ replacement = '- ' )
1167
+ public function slugify ($ replacement = '- ' , $ language = ' en ' )
1166
1168
{
1167
- $ stringy = $ this ->toAscii ();
1169
+ $ stringy = $ this ->toAscii ($ language );
1168
1170
1169
1171
$ stringy ->str = str_replace ('@ ' , $ replacement , $ stringy );
1170
1172
$ quotedReplacement = preg_quote ($ replacement );
You can’t perform that action at this time.
0 commit comments