class MimeType (View source)

Properties

static protected array $mimes

An array of extension to MIME types.

Methods

static string
from(string $filename)

Get the MIME type for a file based on the file's extension.

static string|array
get(string|null $extension = null)

Get the MIME type for a given extension or return all mimes.

static string|null
search(string $mimeType)

Search for the extension of a given MIME type.

static string
getMimeTypeFromExtension(string $extension)

Get the MIME type for a given extension.

Details

static string from(string $filename)

Get the MIME type for a file based on the file's extension.

Parameters

string $filename

Return Value

string

static string|array get(string|null $extension = null)

Get the MIME type for a given extension or return all mimes.

Parameters

string|null $extension

Return Value

string|array

Search for the extension of a given MIME type.

Parameters

string $mimeType

Return Value

string|null

static protected string getMimeTypeFromExtension(string $extension)

Get the MIME type for a given extension.

Parameters

string $extension

Return Value

string