Documentation

Ebook
in package

Table of Contents

Properties

$archive  : BaseArchive|null
$audio  : Audio|null
$authorMain  : BookAuthor|null
$authors  : array<string|int, BookAuthor>
$basename  : string
$copyright  : string|null
$countsParsed  : bool
$cover  : EbookCover|null
$createdAt  : DateTime|null
$description  : string|null
$execTime  : float|null
$extension  : string
$extras  : array<string, mixed>
$filename  : string
$format  : EbookFormatEnum|null
$hasParser  : bool
$identifiers  : array<string|int, BookIdentifier>
$isArchive  : bool
$isAudio  : bool
$isBadFile  : bool
$isMobi  : bool
$language  : string|null
$metaTitle  : MetaTitle|null
$pagesCount  : int|null
$parser  : EbookParser|null
$path  : string
$publishDate  : DateTime|null
$publisher  : string|null
$series  : string|null
$size  : int
$tags  : array<string|int, string>
$title  : string|null
$volume  : int|float|null
$wordsCount  : int|null

Methods

__toString()  : string
create()  : ArchiveZipCreate
Create an ebook file.
getArchive()  : BaseArchive|null
Archive reader, from `kiwilan/php-archive`.
getAudio()  : Audio|null
Audio reader, from `kiwilan/php-audio`.
getAuthorMain()  : BookAuthor|null
First author of the book (useful if you need to display only one author).
getAuthors()  : array<string|int, BookAuthor>
All authors of the book.
getBasename()  : string
Basename of the ebook, e.g. `The Clan of the Cave Bear.epub`.
getCopyright()  : string|null
Copyright of the book.
getCover()  : EbookCover|null
Cover of the ebook.
getCreatedAt()  : DateTime|null
Creation date of the ebook.
getDescription()  : string|null
Raw description of the book.
getDescriptionAdvanced()  : BookDescription
Advanced description with multi-options for the book.
getExecTime()  : float|null
Execution time for parsing the ebook.
getExtension()  : string
Extension of the ebook, e.g. `epub`.
getExtra()  : mixed
Get key from `extras` safely.
getExtras()  : array<string, mixed>
Extras of the ebook.
getFilename()  : string
Filename of the ebook, e.g. `The Clan of the Cave Bear`.
getFormat()  : EbookFormatEnum|null
Format of the ebook.
getIdentifiers()  : array<string|int, BookIdentifier>
Identifiers of the book.
getLanguage()  : string|null
Language of the book.
getMetadata()  : EbookParser|null
Parser of the ebook.
getMetaTitle()  : MetaTitle|null
Title metadata of the book with slug, sort title, series slug, etc.
getPagesCount()  : int|null
Page count of the ebook.
getParser()  : EbookParser|null
Parser of the ebook.
getPath()  : string
Physical path to the ebook.
getPublishDate()  : DateTime|null
Publish date of the book.
getPublisher()  : string|null
Publisher of the book.
getSeries()  : string|null
Series of the book.
getSize()  : int
Size of the ebook, in bytes.
getSizeHumanReadable()  : string
Size of the ebook in human readable format, e.g. `1.23 MB`.
getTags()  : array<string|int, string>
Tags of the book.
getTitle()  : string|null
Title of the book.
getVolume()  : int|float|null
Volume of the book.
getWordsCount()  : int|null
Word count of the ebook.
hasCover()  : bool
Whether the ebook has a cover.
hasMetadata()  : bool
Whether the ebook has parser.
hasParser()  : bool
Whether the ebook has parser.
hasSeries()  : bool
Whether the ebook has series.
isArchive()  : bool
Whether the ebook is an archive.
isAudio()  : bool
Whether the ebook is an audio.
isBadFile()  : bool
Whether the ebook is a bad file.
isMobi()  : bool
Whether the ebook is a mobi.
isValid()  : bool
Check if an ebook file is valid.
read()  : self|null
Read an ebook file.
setAuthor()  : self
setAuthorMain()  : self
setAuthors()  : self
setCopyright()  : self
setDescription()  : self
setExtra()  : self
setExtras()  : self
setHasParser()  : self
setIdentifier()  : self
setIdentifiers()  : self
setLanguage()  : self
setMetaTitle()  : self
setPagesCount()  : self
setPublishDate()  : self
setPublisher()  : self
setSeries()  : self
setTag()  : self
setTags()  : self
setTitle()  : self
setVolume()  : self
setWordsCount()  : self
toArray()  : array<string|int, mixed>
toJson()  : string
toXml()  : string|null
wordsByPage()  : int
__construct()  : mixed
audiobook()  : EbookModule
cba()  : EbookModule
clean()  : self
convertCounts()  : self
convertEbook()  : self
djvu()  : EbookModule
epub()  : EbookModule
fb2()  : EbookModule
generateFileMetadata()  : void
Generate file metadata.
mobi()  : EbookModule
parseFile()  : Ebook
Parse an ebook file.
pdf()  : EbookModule

Properties

$audio

protected Audio|null $audio = null

$basename

protected string $basename
protected string|null $copyright = null

$countsParsed

protected bool $countsParsed = false

$createdAt

protected DateTime|null $createdAt = null

$description

protected string|null $description = null

$execTime

protected float|null $execTime = null

$extension

protected string $extension

$extras

protected array<string, mixed> $extras = []

$filename

protected string $filename

$hasParser

protected bool $hasParser = false

$isArchive

protected bool $isArchive = false

$isAudio

protected bool $isAudio = false

$isBadFile

protected bool $isBadFile = false

$isMobi

protected bool $isMobi = false

$language

protected string|null $language = null

$pagesCount

protected int|null $pagesCount = null

$path

protected string $path

$publishDate

protected DateTime|null $publishDate = null

$publisher

protected string|null $publisher = null

$series

protected string|null $series = null

$size

protected int $size = 0

$tags

protected array<string|int, string> $tags = []

$title

protected string|null $title = null

$volume

protected int|float|null $volume = null

$wordsCount

protected int|null $wordsCount = null

Methods

__toString()

public __toString() : string
Return values
string

getArchive()

Archive reader, from `kiwilan/php-archive`.

public getArchive() : BaseArchive|null
Tags
docs

https://github.com/kiwilan/php-archive

Return values
BaseArchive|null

getAudio()

Audio reader, from `kiwilan/php-audio`.

public getAudio() : Audio|null

You have to install kiwilan/php-audio to use this feature.

Tags
docs

https://github.com/kiwilan/php-audio

Return values
Audio|null

getAuthorMain()

First author of the book (useful if you need to display only one author).

public getAuthorMain() : BookAuthor|null
Return values
BookAuthor|null

getAuthors()

All authors of the book.

public getAuthors() : array<string|int, BookAuthor>
Return values
array<string|int, BookAuthor>

getBasename()

Basename of the ebook, e.g. `The Clan of the Cave Bear.epub`.

public getBasename() : string
Return values
string

getCopyright()

Copyright of the book.

public getCopyright([int|null $limit = null ]) : string|null
Parameters
$limit : int|null = null
Return values
string|null

getCreatedAt()

Creation date of the ebook.

public getCreatedAt() : DateTime|null
Return values
DateTime|null

getDescription()

Raw description of the book.

public getDescription() : string|null
Return values
string|null

getExecTime()

Execution time for parsing the ebook.

public getExecTime() : float|null
Return values
float|null

getExtension()

Extension of the ebook, e.g. `epub`.

public getExtension() : string
Return values
string

getExtra()

Get key from `extras` safely.

public getExtra(string $key) : mixed
Parameters
$key : string

getExtras()

Extras of the ebook.

public getExtras() : array<string, mixed>
Return values
array<string, mixed>

getFilename()

Filename of the ebook, e.g. `The Clan of the Cave Bear`.

public getFilename() : string
Return values
string

getLanguage()

Language of the book.

public getLanguage() : string|null
Return values
string|null

getMetaTitle()

Title metadata of the book with slug, sort title, series slug, etc.

public getMetaTitle() : MetaTitle|null

Can be null if the title is null.

Return values
MetaTitle|null

getPagesCount()

Page count of the ebook.

public getPagesCount() : int|null
Return values
int|null

getPath()

Physical path to the ebook.

public getPath() : string
Return values
string

getPublishDate()

Publish date of the book.

public getPublishDate() : DateTime|null
Return values
DateTime|null

getPublisher()

Publisher of the book.

public getPublisher() : string|null
Return values
string|null

getSeries()

Series of the book.

public getSeries() : string|null
Return values
string|null

getSize()

Size of the ebook, in bytes.

public getSize() : int

You can use getSizeHumanReadable() to get the size in human readable format.

Return values
int

getSizeHumanReadable()

Size of the ebook in human readable format, e.g. `1.23 MB`.

public getSizeHumanReadable() : string
Return values
string

getTags()

Tags of the book.

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

getTitle()

Title of the book.

public getTitle() : string|null
Return values
string|null

getVolume()

Volume of the book.

public getVolume() : int|float|null
Return values
int|float|null

getWordsCount()

Word count of the ebook.

public getWordsCount() : int|null
Return values
int|null

hasCover()

Whether the ebook has a cover.

public hasCover() : bool
Return values
bool

hasMetadata()

Whether the ebook has parser.

public hasMetadata() : bool

Use hasParser() instead.

Return values
bool

hasParser()

Whether the ebook has parser.

public hasParser() : bool
Return values
bool

hasSeries()

Whether the ebook has series.

public hasSeries() : bool
Return values
bool

isArchive()

Whether the ebook is an archive.

public isArchive() : bool
Return values
bool

isAudio()

Whether the ebook is an audio.

public isAudio() : bool
Return values
bool

isBadFile()

Whether the ebook is a bad file.

public isBadFile() : bool
Return values
bool

isMobi()

Whether the ebook is a mobi.

public isMobi() : bool
Return values
bool

isValid()

Check if an ebook file is valid.

public static isValid(string $path) : bool
Parameters
$path : string
Return values
bool

read()

Read an ebook file.

public static read(string $path) : self|null
Parameters
$path : string
Return values
self|null

setAuthorMain()

public setAuthorMain(BookAuthor|null $authorMain) : self
Parameters
$authorMain : BookAuthor|null
Return values
self

setAuthors()

public setAuthors(array<string|int, BookAuthor$authors) : self
Parameters
$authors : array<string|int, BookAuthor>
Return values
self

setCopyright()

public setCopyright(string|null $copyright) : self
Parameters
$copyright : string|null
Return values
self

setDescription()

public setDescription(string|array<string|int, mixed>|null $description) : self
Parameters
$description : string|array<string|int, mixed>|null
Return values
self

setExtra()

public setExtra(mixed $value[, string|null $key = null ]) : self
Parameters
$value : mixed
$key : string|null = null
Return values
self

setExtras()

public setExtras(array<string, mixed> $extras) : self
Parameters
$extras : array<string, mixed>
Return values
self

setHasParser()

public setHasParser(bool $hasParser) : self
Parameters
$hasParser : bool
Return values
self

setIdentifiers()

public setIdentifiers(array<string|int, BookIdentifier$identifiers) : self
Parameters
$identifiers : array<string|int, BookIdentifier>
Return values
self

setLanguage()

public setLanguage(string|null $language) : self
Parameters
$language : string|null
Return values
self

setMetaTitle()

public setMetaTitle(Ebook $ebook) : self
Parameters
$ebook : Ebook
Return values
self

setPagesCount()

public setPagesCount(int|null $pagesCount) : self
Parameters
$pagesCount : int|null
Return values
self

setPublishDate()

public setPublishDate(DateTime|null $publishDate) : self
Parameters
$publishDate : DateTime|null
Return values
self

setPublisher()

public setPublisher(string|null $publisher) : self
Parameters
$publisher : string|null
Return values
self

setSeries()

public setSeries(string|null $series) : self
Parameters
$series : string|null
Return values
self

setTag()

public setTag(string|null $tag) : self
Parameters
$tag : string|null
Return values
self

setTags()

public setTags(array<string|int, string>|null $tags) : self
Parameters
$tags : array<string|int, string>|null
Return values
self

setTitle()

public setTitle(string|null $title) : self
Parameters
$title : string|null
Return values
self

setVolume()

public setVolume(int|string|float|null $volume) : self
Parameters
$volume : int|string|float|null
Return values
self

setWordsCount()

public setWordsCount(int|null $wordsCount) : self
Parameters
$wordsCount : int|null
Return values
self

toArray()

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

toJson()

public toJson() : string
Return values
string

toXml()

public toXml(string $path) : string|null
Parameters
$path : string
Return values
string|null

wordsByPage()

public static wordsByPage() : int
Return values
int

__construct()

protected __construct(string $path, string $filename, string $basename, string $extension[, int $size = 0 ][, DateTime|null $createdAt = null ][, BaseArchive|null $archive = null ][, Audio|null $audio = null ][, bool $isArchive = false ][, bool $isAudio = false ][, bool $isMobi = false ][, bool $isBadFile = false ][, EbookParser|null $parser = null ][, bool $hasParser = false ]) : mixed
Parameters
$path : string
$filename : string
$basename : string
$extension : string
$size : int = 0
$createdAt : DateTime|null = null
$archive : BaseArchive|null = null
$audio : Audio|null = null
$isArchive : bool = false
$isAudio : bool = false
$isMobi : bool = false
$isBadFile : bool = false
$parser : EbookParser|null = null
$hasParser : bool = false

clean()

private clean() : self
Return values
self

convertCounts()

private convertCounts() : self
Return values
self

convertEbook()

private convertEbook() : self
Return values
self

generateFileMetadata()

Generate file metadata.

private generateFileMetadata() : void

parseFile()

Parse an ebook file.

private static parseFile(string $path) : Ebook
Parameters
$path : string
Return values
Ebook

        
On this page

Search results