Slugger
final class Slugger (View source)
Generates best-effort ASCII slugs for use in URLs.
Inspired by the former URLify utility and its curated transliteration maps, this is not a universal Unicode transliterator. Unknown or unsupported characters are discarded, so an unsupported input can produce an empty slug.
Constants
| DEFAULT_LOCALE |
Default locale used to select the preferred transliteration map. |
| private SUPPORTED_LOCALES |
|
| private MAPS |
Internal fallback and language maps copied from the former URLify utility. |
Methods
Converts text into a lowercase ASCII URL slug.
Returns explicit language locale maps available to applications.
Details
slug
string
slug(string $text, int $maxLength = 120, string $locale = self::DEFAULT_LOCALE)
Converts text into a lowercase ASCII URL slug.
supportedLocales
array
supportedLocales()
Returns explicit language locale maps available to applications.
Internal fallback maps such as latin and latin_symbols are excluded.