Documentation

MetaTitle
in package

Convert eBook title and metadata to a slug.

Table of Contents

Constants

DETERMINERS  = ['en' => ['the ', 'a ', 'an ', 'some ', 'any ', 'this ', 'that ', 'my ', 'your ', 'his ', 'her ', 'its ', 'our ', 'their ', 'all ', 'both ', 'each '], 'fr' => ['les ', 'l\'', 'le ', 'la ', 'du ', 'de ', 'une ', 'au ', 'des ', 'ce ', 'cet ', 'cette ', 'ces ', 'mon ', 'ton ', 'son ', 'notre ', 'votre ', 'leur ', 'tous ', 'toutes ', 'chaque '], 'es' => ['el ', 'la ', 'los ', 'las ', 'un ', 'una ', 'este ', 'esta ', 'estos ', 'estas ', 'mi ', 'tu ', 'su ', 'nuestro ', 'vuestro ', 'sus ', 'mío ', 'tuyo ', 'suyo ', 'algunos ', 'algunas ', 'todo ', 'toda ', 'todos ', 'todas ', 'otro ', 'otra '], 'it' => ['il ', 'la ', 'i ', 'gli ', 'le ', 'un ', 'uno ', 'una ', 'alcuni ', 'alcune ', 'questo ', 'questa ', 'questi ', 'queste ', 'quel ', 'quella ', 'quelli ', 'quelle ', 'mia ', 'tua ', 'sua ', 'nostra ', 'vostra ', 'loro ', 'ogni ', 'tutti ', 'tutte ', 'alcuni ', 'alcune ', 'qualche '], 'de' => ['der ', 'die ', 'das ', 'ein ', 'eine ', 'mein ', 'dein ', 'sein ', 'ihr ', 'unser ', 'euer ', 'ihr ', 'jeder ', 'jede ', 'jedes ', 'alle ', 'viel ', 'einige ', 'ein paar ', 'manche ', 'welcher ', 'welche ', 'welches '], 'pl' => ['ten ', 'ta ', 'to ', 'te ', 'tamten ', 'tamta ', 'tamto ', 'jaki ', 'jaka ', 'jakie ', 'każdy ', 'każda ', 'każde ', 'wszystki ', 'wszystko ', 'wszyscy ', 'wszystkie ', 'który ', 'która ', 'które ', 'którzy ', 'której ', 'którego ', 'którym '], 'ru' => ['этот ', 'эта ', 'это ', 'эти ', 'тот ', 'та ', 'то ', 'те ', 'весь ', 'вся ', 'всё ', 'все ', 'каждый ', 'каждая ', 'каждое ', 'каждые ', 'мой ', 'моя ', 'моё ', 'мои ', 'твой ', 'твоя ', 'твоё ', 'твои ', 'свой ', 'своя ', 'своё ', 'свои ', 'наш ', 'наша ', 'наше ', 'наши ', 'ваш ', 'ваша ', 'ваше ', 'ваши ', 'их ', 'их ', 'некоторые ', 'всякий ', 'любой ', 'каждый '], 'zh' => ['这 ', '那 ', '一个 ', '这些 ', '那些 '], 'ja' => ['これ ', 'それ ', 'あれ ', 'この ', 'その ', 'あの '], 'ko' => ['이 ', '그 ', '저 ', '이것 ', '그것 ', '저것 '], 'ar' => ['هذا ', 'هذه ', 'ذلك ', 'تلك ', 'هؤلاء ', 'تلكم '], 'pt' => ['o ', 'a ', 'os ', 'as ', 'um ', 'uma '], 'nl' => ['de ', 'het ', 'een ', 'deze ', 'dit ', 'die '], 'sv' => ['den ', 'det ', 'en ', 'ett ', 'dessa ', 'dessa '], 'tr' => ['bu ', 'şu ', 'o ', 'bir ', 'bu ', 'şu ']]

Properties

$author  : string|null
$extension  : string|null
$language  : string|null
$originalSeries  : string|null
$originalTitle  : string|null
$series  : string|null
$seriesDeterminer  : string|null
$title  : string|null
$titleDeterminer  : string|null
$useIntl  : bool
$volume  : string|null
$year  : string|null

Methods

__toString()  : string
fromData()  : self
Create a new MetaTitle instance from data.
fromEbook()  : self|null
Create a new MetaTitle instance from an Ebook.
getSerieSlug()  : string|null
getSerieSlugSort()  : string|null
getSerieSlugUnique()  : string|null
getSeriesSlug()  : string|null
Get slug of serie title, like `lord-of-the-rings-j-r-r-tolkien-epub-en`.
getSeriesSlugSimple()  : string|null
getSlug()  : string
Get slug of book title with addional metadata, like `lord-of-the-rings-001-fellowship-of-the-ring-j-r-r-tolkien-1954-epub-en` with default values.
getSlugSimple()  : string
getSlugSort()  : string
getSlugSortWithSerie()  : string
getSlugUnique()  : string
getUniqueFilename()  : string
removeAccents()  : string|null
toArray()  : array<string|int, mixed>
__construct()  : mixed
generateSlug()  : string|null
Generate `slug` with params.
parse()  : static
parseVolume()  : string|null
removeDeterminers()  : string|null
removeDots()  : string|null
slugifier()  : string|null
Laravel export.
slugifierIntl()  : string|null
slugifierNative()  : string|null

Constants

DETERMINERS

public array<string|int, array<string|int, string>> DETERMINERS = ['en' => ['the ', 'a ', 'an ', 'some ', 'any ', 'this ', 'that ', 'my ', 'your ', 'his ', 'her ', 'its ', 'our ', 'their ', 'all ', 'both ', 'each '], 'fr' => ['les ', 'l\'', 'le ', 'la ', 'du ', 'de ', 'une ', 'au ', 'des ', 'ce ', 'cet ', 'cette ', 'ces ', 'mon ', 'ton ', 'son ', 'notre ', 'votre ', 'leur ', 'tous ', 'toutes ', 'chaque '], 'es' => ['el ', 'la ', 'los ', 'las ', 'un ', 'una ', 'este ', 'esta ', 'estos ', 'estas ', 'mi ', 'tu ', 'su ', 'nuestro ', 'vuestro ', 'sus ', 'mío ', 'tuyo ', 'suyo ', 'algunos ', 'algunas ', 'todo ', 'toda ', 'todos ', 'todas ', 'otro ', 'otra '], 'it' => ['il ', 'la ', 'i ', 'gli ', 'le ', 'un ', 'uno ', 'una ', 'alcuni ', 'alcune ', 'questo ', 'questa ', 'questi ', 'queste ', 'quel ', 'quella ', 'quelli ', 'quelle ', 'mia ', 'tua ', 'sua ', 'nostra ', 'vostra ', 'loro ', 'ogni ', 'tutti ', 'tutte ', 'alcuni ', 'alcune ', 'qualche '], 'de' => ['der ', 'die ', 'das ', 'ein ', 'eine ', 'mein ', 'dein ', 'sein ', 'ihr ', 'unser ', 'euer ', 'ihr ', 'jeder ', 'jede ', 'jedes ', 'alle ', 'viel ', 'einige ', 'ein paar ', 'manche ', 'welcher ', 'welche ', 'welches '], 'pl' => ['ten ', 'ta ', 'to ', 'te ', 'tamten ', 'tamta ', 'tamto ', 'jaki ', 'jaka ', 'jakie ', 'każdy ', 'każda ', 'każde ', 'wszystki ', 'wszystko ', 'wszyscy ', 'wszystkie ', 'który ', 'która ', 'które ', 'którzy ', 'której ', 'którego ', 'którym '], 'ru' => ['этот ', 'эта ', 'это ', 'эти ', 'тот ', 'та ', 'то ', 'те ', 'весь ', 'вся ', 'всё ', 'все ', 'каждый ', 'каждая ', 'каждое ', 'каждые ', 'мой ', 'моя ', 'моё ', 'мои ', 'твой ', 'твоя ', 'твоё ', 'твои ', 'свой ', 'своя ', 'своё ', 'свои ', 'наш ', 'наша ', 'наше ', 'наши ', 'ваш ', 'ваша ', 'ваше ', 'ваши ', 'их ', 'их ', 'некоторые ', 'всякий ', 'любой ', 'каждый '], 'zh' => ['这 ', '那 ', '一个 ', '这些 ', '那些 '], 'ja' => ['これ ', 'それ ', 'あれ ', 'この ', 'その ', 'あの '], 'ko' => ['이 ', '그 ', '저 ', '이것 ', '그것 ', '저것 '], 'ar' => ['هذا ', 'هذه ', 'ذلك ', 'تلك ', 'هؤلاء ', 'تلكم '], 'pt' => ['o ', 'a ', 'os ', 'as ', 'um ', 'uma '], 'nl' => ['de ', 'het ', 'een ', 'deze ', 'dit ', 'die '], 'sv' => ['den ', 'det ', 'en ', 'ett ', 'dessa ', 'dessa '], 'tr' => ['bu ', 'şu ', 'o ', 'bir ', 'bu ', 'şu ']]

Properties

$author

protected string|null $author = null

$extension

protected string|null $extension = null

$language

protected string|null $language = null

$originalSeries

protected string|null $originalSeries = null

$originalTitle

protected string|null $originalTitle = null

$series

protected string|null $series = null

$seriesDeterminer

protected string|null $seriesDeterminer = null

$titleDeterminer

protected string|null $titleDeterminer = null

$volume

protected string|null $volume = null

Methods

__toString()

public __toString() : string
Return values
string

fromData()

Create a new MetaTitle instance from data.

public static fromData(string $title[, string|null $language = null ][, string|null $series = null ][, string|int|float|null $volume = null ][, string|null $author = null ][, string|int|null $year = null ][, string|null $extension = null ][, bool $useIntl = true ]) : self
Parameters
$title : string
$language : string|null = null
$series : string|null = null
$volume : string|int|float|null = null
$author : string|null = null
$year : string|int|null = null
$extension : string|null = null
$useIntl : bool = true

Use intl extension for slugify.

Return values
self

fromEbook()

Create a new MetaTitle instance from an Ebook.

public static fromEbook(Ebook $ebook[, bool $useIntl = true ]) : self|null
Parameters
$ebook : Ebook
$useIntl : bool = true

Use intl extension for slugify.

Return values
self|null

getSerieSlug()

public getSerieSlug() : string|null

Use getSeriesSlugSimple() instead.

Return values
string|null

getSerieSlugSort()

public getSerieSlugSort() : string|null

Use getSeriesSlug() instead.

Return values
string|null

getSerieSlugUnique()

public getSerieSlugUnique() : string|null

Use getSeriesSlug() instead.

Return values
string|null

getSeriesSlug()

Get slug of serie title, like `lord-of-the-rings-j-r-r-tolkien-epub-en`.

public getSeriesSlug([bool $removeDeterminers = true ][, bool $addAuthor = false ][, bool $addExtension = false ][, bool $addLanguage = true ]) : string|null
Parameters
$removeDeterminers : bool = true

, here The

$addAuthor : bool = false

name, here J. R. R. Tolkien, default false

$addExtension : bool = false

, here epub, default false

$addLanguage : bool = true

, here en

Return values
string|null

getSeriesSlugSimple()

public getSeriesSlugSimple() : string|null

Use getSeriesSlug() instead.

Get simple slug of serie title, like the-lord-of-the-rings.

Return values
string|null

getSlug()

Get slug of book title with addional metadata, like `lord-of-the-rings-001-fellowship-of-the-ring-j-r-r-tolkien-1954-epub-en` with default values.

public getSlug([bool $removeDeterminers = true ][, bool $addSeries = true ][, bool $addVolume = true ][, bool $addAuthor = true ][, bool $addYear = true ][, bool $addExtension = true ][, bool $addLanguage = true ]) : string
Parameters
$removeDeterminers : bool = true

Remove determiners, here The

$addSeries : bool = true

Add serie title, here Lord of the Rings (if book has series)

$addVolume : bool = true

Add volume, here 1

$addAuthor : bool = true

Add author name, here J. R. R. Tolkien

$addYear : bool = true

Add year, here 1954

$addExtension : bool = true

Add extension, here epub

$addLanguage : bool = true

Add language, here en

Return values
string

getSlugSimple()

public getSlugSimple() : string

Use getSlug() with parameters instead.

Get simple slug of book title, like the-fellowship-of-the-ring.

Return values
string

getSlugSort()

public getSlugSort() : string

Use getSlug() instead.

Return values
string

getSlugSortWithSerie()

public getSlugSortWithSerie() : string

Use getSlug() instead.

Return values
string

getSlugUnique()

public getSlugUnique() : string

Use getSlug() instead.

Return values
string

getUniqueFilename()

public getUniqueFilename() : string

Use getSlug() instead.

Return values
string

removeAccents()

public removeAccents(string|null $string) : string|null
Parameters
$string : string|null
Return values
string|null

toArray()

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

__construct()

protected __construct([string|null $originalTitle = null ][, string|null $originalSeries = null ][, string|null $title = null ][, string|null $language = null ][, string|null $series = null ][, string|null $volume = null ][, string|null $author = null ][, string|null $year = null ][, string|null $extension = null ][, string|null $titleDeterminer = null ][, string|null $seriesDeterminer = null ][, bool $useIntl = true ]) : mixed
Parameters
$originalTitle : string|null = null
$originalSeries : string|null = null
$title : string|null = null
$language : string|null = null
$series : string|null = null
$volume : string|null = null
$author : string|null = null
$year : string|null = null
$extension : string|null = null
$titleDeterminer : string|null = null
$seriesDeterminer : string|null = null
$useIntl : bool = true

generateSlug()

Generate `slug` with params.

private generateSlug(array<string|int, string>|array<string|int, null>|string $strings) : string|null
Parameters
$strings : array<string|int, string>|array<string|int, null>|string
Return values
string|null

parse()

private parse() : static
Return values
static

parseVolume()

private parseVolume(string|null $volume) : string|null
Parameters
$volume : string|null
Return values
string|null

removeDeterminers()

private removeDeterminers(string|null $string, string|null $language) : string|null
Parameters
$string : string|null
$language : string|null
Return values
string|null

removeDots()

private removeDots(string|null $string) : string|null
Parameters
$string : string|null
Return values
string|null

slugifier()

Laravel export.

private slugifier(string|null $title[, string $separator = '-' ][, array<string, string> $dictionary = ['@' => 'at'] ]) : string|null

Generate a URL friendly "slug" from a given string.

Parameters
$title : string|null
$separator : string = '-'
$dictionary : array<string, string> = ['@' => 'at']
Return values
string|null

slugifierIntl()

private slugifierIntl(string|null $text[, string $divider = '-' ][, array<string|int, mixed> $dictionary = ['@' => 'at'] ]) : string|null
Parameters
$text : string|null
$divider : string = '-'
$dictionary : array<string|int, mixed> = ['@' => 'at']
Return values
string|null

slugifierNative()

private slugifierNative(string|null $text[, string $divider = '-' ]) : string|null
Parameters
$text : string|null
$divider : string = '-'
Return values
string|null

        
On this page

Search results