The "Nishadil\Extmime" PHP package offers a convenient solution for developers seeking to effortlessly convert between file MIME types and extensions within their projects. By leveraging this package, developers can seamlessly map MIME types to file extensions and vice versa, simplifying file handling tasks.
To integrate "Nishadil\Extmime" into your project, simply clone this git repo or use Composer with the following command:
composer require nishadil/extmime <?php
use Nishadil\Extmime;
$extmime = new Extmime;
$result = $extmime->getExtension("image/jpeg");
echo $result;
?>Output :
.jpg
<?php
use Nishadil\Extmime;
$extmime = new Extmime;
$result = $extmime->getMimeType(".jpg");
echo $result;
?>Output :
.image/jpeg