1. Go to this page and download the library: Download narrowspark/mimetypes library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
narrowspark / mimetypes example snippets
use Narrowspark\MimeType\MimeType;
// You can register custom guessers by calling the register() method
MimeType::register('CustomGuesser');
return MimeType::guess('image.gif'); // returns image/gif
use Narrowspark\MimeType\MimeTypesList;
return MimeTypesList::MIMES; // returns array
use Narrowspark\MimeType\MimeTypeFileInfoGuesser;
use Narrowspark\MimeType\MimeTypeFileBinaryGuesser;
use Narrowspark\MimeType\MimeTypeExtensionGuesser;
use Narrowspark\MimeType\MimeTypeFileExtensionGuesser;
// Inspecting the file using finfo and relies on magic db files.
return MimeTypeFileInfoGuesser::guess('image.gif'); // returns image/gif
// Inspecting the file using file -b --mime
return MimeTypeFileBinaryGuesser::guess('image.gif'); // returns image/gif
// Inspecting the extension using mime type list
return MimeTypeExtensionGuesser::guess('gif'); // returns image/gif
// Inspecting the file using mime type list
return MimeTypeFileExtensionGuesser::guess('image.gif'); // returns image/gif
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.