php-extended/php-mime-type-catalog

The catalog of mime types taken from the iana official list


Keywords
php, catalog, mime, type, iana
License
MIT

Documentation

php-mime-type-catalog

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.

Last Updated Date : 2020-01-26

Installation

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.

Basic Usage

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

License

MIT (See license file