PHP code example of blobfolio / blob-mimes

1. Go to this page and download the library: Download blobfolio/blob-mimes 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/ */

    

blobfolio / blob-mimes example snippets


$foo = blobfolio\mimes\mimes::check_ext_and_mime('jpeg', 'image/jpeg'); //TRUE
$foo = blobfolio\mimes\mimes::check_ext_and_mime('jpeg', 'image/gif'); //FALSE

print_r(blobfolio\mimes\mimes::finfo('../wp/img/blobfolio.svg'));
/*
array(
    [dirname] => /var/www/blob-common/wp/img
    [basename] => blobfolio.svg
    [extension] => svg
    [filename] => blobfolio
    [path] => /var/www/blob-common/wp/img/blobfolio.svg
    [mime] => image/svg+xml
    [suggested_filename] => array()
)
*/

print_r(blobfolio\mimes\mimes::get_extension('jpeg'));
/*
array(
    [ext] => jpeg
    [mime] => array(
        0 => image/jpeg
        1 => image/pjpeg
    )
)
*/

print_r(blobfolio\mimes\mimes::get_mime('image/jpeg'));
/*
array(
    [mime] => image/jpeg
    [ext] => array(
        0 => jpeg
        1 => jpg
        2 => jpe
    )
    [source] => array(
        0 => Apache
        1 => Nginx
        2 => freedesktop.org
    )
)
*/