Use typify to identify and apply mime types information to your files and responses.
This package requires PHP 8.4 or higher.
Install via Composer:
composer require decodelabs/typifyDetect a mime type for a file path:
use DecodeLabs\Typify\Detector;
$detector = new Detector();
echo $detector->detect(__FILE__);
// application/x-phpGet known extensions for a type:
$exts = $detector->getExtensionsFor('text/plain');
// txt, text, conf, def, list, log, inSuggest an extension for a mime type:
echo $detector->getExtensionFor('text/plain');
// txtTypify is licensed under the MIT License. See LICENSE for the full license text.