nishadil / extmime
PHP package for converting file MIME Type to extension and vice versa.
v1.1.0
2023-12-28 12:44 UTC
This package is not auto-updated.
Last update: 2025-04-18 11:52:43 UTC
README
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.
How to install
To integrate "Nishadil\Extmime" into your project, simply clone this git repo or use Composer with the following command:
composer require nishadil/extmime
How to use
Get mime type from file extension
<?php use Nishadil\Extmime; $extmime = new Extmime; $result = $extmime->getExtension("image/jpeg"); echo $result; ?>
Output :
.jpg
Get extension from file mime type
<?php use Nishadil\Extmime; $extmime = new Extmime; $result = $extmime->getMimeType(".jpg"); echo $result; ?>
Output :
.image/jpeg