A PHP library to detect the mime type of files.
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|
|2.x||Latest (recommended)||min. 5.6|
If you're using PHP 5.6 or higher, you should use the latest 2.x version. There is no difference in usage between 1.x and 2.x, so the upgrade should not require any code changes.
Differences between 1.x and 2.x:
- versions of composer dependencies
$type = \MimeType\MimeType::getType('my-file.pdf'); // returns "application/pdf"