1. Go to this page and download the library: Download wgenial/php-mimetyper 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/ */
wgenial / php-mimetyper example snippets
use MimeTyper\Repository\MimeDbRepository;
$mimeRepository = new MimeDbRepository();
$mimeRepository->findExtensions("image/jpeg"); // ["jpeg","jpg","jpe"]
$mimeRepository->findExtension("image/jpeg"); // "jpeg"
$mimeRepository->findType("html"); // "html"
$mimeRepository->findType("js"); // 'application/javascript'
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
use MimeTyper\Repository\ExtendedRepository;
use MimeTyper\Symfony\ExtraMimeTypeExtensionGuesser;
$symfonyGuesser = ExtensionGuesser::getInstance();
$extraGuesser = new ExtraMimeTypeExtensionGuesser(
new ExtendedRepository()
);
$symfonyGuesser->register($extraGuesser);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.