PHP code example of moudarir / mime-detector

1. Go to this page and download the library: Download moudarir/mime-detector 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/ */

    

moudarir / mime-detector example snippets




use Moudarir\MimeDetector\Exceptions\MimeDetectorException;
use Moudarir\MimeDetector\Detector;

tures/document.pdf');
$metadata = $result->metadata();

echo '<div style="margin-bottom: 20px;">';
echo '<h4 style="margin-bottom: 10px;">Mime Type</h4>';
echo '<pre>';
var_dump($result->mimeType(), $result->value());
echo '</pre>';
echo '</div>';

echo '<div style="margin-bottom: 20px;">';
echo '<h4 style="margin-bottom: 10px;">Detector</h4>';
echo '<pre>';
var_dump($result->detector(), $result->detectorValue());
echo '</pre>';
echo '</div>';

echo '<div style="margin-bottom: 20px;">';
echo '<h4 style="margin-bottom: 10px;">Metadata</h4>';
echo '<pre>';
var_dump(
    $metadata->filesize(),
    $metadata->dirname(),
    $metadata->basename(),
    $metadata->filename(),
    $metadata->extension(),
);
echo '</pre>';
echo '</div>';