php-extended/php-mime-type-catalog

This package is abandoned and no longer maintained. The author suggests using the php-extended/php-mime-type-object package instead.

The catalog of mime types taken from the iana official list


README

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-09-27

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": "^2",
		...
	}

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