FileAccess Orion

MimeTypesInterface extends MimeTypeGuesserInterface

Guesses the MIME type of a file.

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

getExtensions()  : array<string|int, string>
Gets the extensions for the given MIME type.
getMimeTypes()  : array<string|int, string>
Gets the MIME types for the given extension.
guessMimeType()  : string|null
Guesses the MIME type of the file with the given path.
isGuesserSupported()  : bool
Returns true if this guesser is supported.

Methods

getExtensions()

Gets the extensions for the given MIME type.

public getExtensions(string $mimeType) : array<string|int, string>
Parameters
$mimeType : string
Return values
array<string|int, string>

an array of extensions (first one is the preferred one)

getMimeTypes()

Gets the MIME types for the given extension.

public getMimeTypes(string $ext) : array<string|int, string>
Parameters
$ext : string
Return values
array<string|int, string>

an array of MIME types (first one is the preferred one)

guessMimeType()

Guesses the MIME type of the file with the given path.

public guessMimeType(string $path) : string|null
Parameters
$path : string

The path to the file

Tags
throws
LogicException

If the guesser is not supported

throws
InvalidArgumentException

If the file does not exist or is not readable

Return values
string|null

The MIME type or null, if none could be guessed

isGuesserSupported()

Returns true if this guesser is supported.

public isGuesserSupported() : bool
Return values
bool

Search results