A PHP library to detect the mime type of a file.
This is a modernised version of Jason Sheets's mimetype class.
To add the PhpMimeType library to your project run
composer require katzien/php-mime-type
from the directory where your composer.json file is.
See Packagist for more details.
Version | Status | PHP version required |
---|---|---|
1.x | Maintained | min. 5.3 |
2.x | Latest | min. 5.6 |
$type = \MimeType\MimeType::getType('my-file.pdf'); // returns "application/pdf"