Documentation

AsciiSlugger
in package
implements SluggerInterface, LocaleAwareInterface

Tags
author

Titouan Galopin galopintitouan@gmail.com

Interfaces, Classes, Traits and Enums

SluggerInterface
Creates a URL-friendly slug from a given string.
LocaleAwareInterface

Table of Contents

LOCALE_TO_TRANSLITERATOR_ID  = ['am' => 'Amharic-Latin', 'ar' => 'Arabic-Latin', 'az' => 'Azerbaijani-Latin', 'be' => 'Belarusian-Latin', 'bg' => 'Bulgarian-Latin', 'bn' => 'Bengali-Latin', 'de' => 'de-ASCII', 'el' => 'Greek-Latin', 'fa' => 'Persian-Latin', 'he' => 'Hebrew-Latin', 'hy' => 'Armenian-Latin', 'ka' => 'Georgian-Latin', 'kk' => 'Kazakh-Latin', 'ky' => 'Kirghiz-Latin', 'ko' => 'Korean-Latin', 'mk' => 'Macedonian-Latin', 'mn' => 'Mongolian-Latin', 'or' => 'Oriya-Latin', 'ps' => 'Pashto-Latin', 'ru' => 'Russian-Latin', 'sr' => 'Serbian-Latin', 'sr_Cyrl' => 'Serbian-Latin', 'th' => 'Thai-Latin', 'tk' => 'Turkmen-Latin', 'uk' => 'Ukrainian-Latin', 'uz' => 'Uzbek-Latin', 'zh' => 'Han-Latin']
$defaultLocale  : string|null
$symbolsMap  : Closure|array<string|int, mixed>
$transliterators  : array<string|int, mixed>
Cache of transliterators per locale.
__construct()  : mixed
getLocale()  : string
{@inheritdoc}
setLocale()  : mixed
{@inheritdoc}
slug()  : AbstractUnicodeString
Creates a slug for the given string and locale, using appropriate transliteration when needed.
createTransliterator()  : Transliterator|null
getParentLocale()  : string|null

Constants

LOCALE_TO_TRANSLITERATOR_ID

private mixed LOCALE_TO_TRANSLITERATOR_ID = ['am' => 'Amharic-Latin', 'ar' => 'Arabic-Latin', 'az' => 'Azerbaijani-Latin', 'be' => 'Belarusian-Latin', 'bg' => 'Bulgarian-Latin', 'bn' => 'Bengali-Latin', 'de' => 'de-ASCII', 'el' => 'Greek-Latin', 'fa' => 'Persian-Latin', 'he' => 'Hebrew-Latin', 'hy' => 'Armenian-Latin', 'ka' => 'Georgian-Latin', 'kk' => 'Kazakh-Latin', 'ky' => 'Kirghiz-Latin', 'ko' => 'Korean-Latin', 'mk' => 'Macedonian-Latin', 'mn' => 'Mongolian-Latin', 'or' => 'Oriya-Latin', 'ps' => 'Pashto-Latin', 'ru' => 'Russian-Latin', 'sr' => 'Serbian-Latin', 'sr_Cyrl' => 'Serbian-Latin', 'th' => 'Thai-Latin', 'tk' => 'Turkmen-Latin', 'uk' => 'Ukrainian-Latin', 'uz' => 'Uzbek-Latin', 'zh' => 'Han-Latin']

Properties

$symbolsMap

private Closure|array<string|int, mixed> $symbolsMap = ['en' => ['@' => 'at', '&' => 'and']]

$transliterators

Cache of transliterators per locale.

private array<string|int, mixed> $transliterators = []

Methods

__construct()

public __construct([string $defaultLocale = null ][, array<string|int, mixed>|Closure $symbolsMap = null ]) : mixed
Parameters
$defaultLocale : string = null
$symbolsMap : array<string|int, mixed>|Closure = null
Return values
mixed

getLocale()

{@inheritdoc}

public getLocale() : string
Return values
string

setLocale()

{@inheritdoc}

public setLocale(string $locale) : mixed
Parameters
$locale : string
Return values
mixed

slug()

Creates a slug for the given string and locale, using appropriate transliteration when needed.

public slug(string $string[, string $separator = '-' ][, string $locale = null ]) : AbstractUnicodeString
Parameters
$string : string
$separator : string = '-'
$locale : string = null
Return values
AbstractUnicodeString

createTransliterator()

private createTransliterator(string $locale) : Transliterator|null
Parameters
$locale : string
Return values
Transliterator|null

getParentLocale()

private static getParentLocale(string|null $locale) : string|null
Parameters
$locale : string|null
Return values
string|null

Search results