1. Go to this page and download the library: Download borschphp/mimetype 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/ */
borschphp / mimetype example snippets
use Borsch\MimeType\MimeType;
use Laminas\Diactoros\Request;
use Laminas\Diactoros\Uri;
$mime_type = new MimeType('application', 'json', ['charset' => 'UTF-8']);
$request = (new Request())
->withUri(new Uri('http://example.com'))
->withMethod('GET')
->withAddedHeader('Content-Type', (string)$mime_type);
use Borsch\MimeType\MediaType;
use Laminas\Diactoros\Request;
use Laminas\Diactoros\Uri;
$request = (new Request())
->withUri(new Uri('http://example.com'))
->withMethod('GET')
->withAddedHeader('Content-Type', MediaType::APPLICATION_JSON);