The catalog of mime types taken from the iana official list
The catalog of mime types taken from the iana official list.
This library uses the iana and apache lists and merges them into comprehensive enumerable objects.
The installation of this library is made via composer.
Download composer.phar
from their website.
Then add to your composer.json :
"require": {
...
"php-extended/php-mime-type-catalog": "^1",
...
}
Then run php composer.phar update
to install this library.
The autoloading of all classes of this library is made through composer's autoloader.
You may use this library the following way:
use PhpExtended\MimeType\MimeType;
foreach(MimeType::values() as $k => $mimeType)
{
/* @var $mimeType \PhpExtended\MimeType\MimeType */
// do what ever you want
}
or, to pick a specific mime type, use the following :
$exactMatch = MimeType::getById('mime/type'); // may be null
$bestFit = MimeType::getBestFitById('mime/type'); // get */* object
MIT (See license file