php-extended/php-iana-media-types-bundle

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

A library to validate mime types

2.0.30 2020-09-13 02:30 UTC

README

A library to validate mime types.

This library uses the https://www.iana.org/assignments/media-types/media-types.xhtml source file to update its contents. This library is updated once a week, every sunday.

Last Updated Date : 2020-09-13

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-iana-media-types-bundle": "^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\MediaTypes\IanaMediaType;

$categoryName = '<put here one of : ['application', 'audio', 'font', 'image', 'message', 'model', 'multipart', 'text', 'video'] >';

$mediaTypeList = new IanaMediaTypesList($categoryName);

foreach($mediaTypeList as $k => $mediaType)
{
	/* @var $mediaType \PhpExtended\MediaTypes\IanaMediaType */
	
	// do what ever you want
}

License

MIT (See license file