PHP code example of lkt / mime

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

    

lkt / mime example snippets


use Lkt\MIME;

// Generic checker
MIME::getByExtension('jpeg');

// Image specific checker
MIME::getImageByExtension('jpg');

// Video specific checker
MIME::getVideoByExtension('mp4');

// Office specific checker. Includes Open/Microsoft Office formats, PDF, CSV, TXT, ABW
MIME::getOfficeByExtension('pdf');

// Archive specific checker. Includes ZIP, 7Z, RAR, BZ, BZ2, TAR, ARC
MIME::getArchiveByExtension('pdf');

// Audio specific checker. Includes MP3, OPUS, OGA, AAC, WEBA, CDA, MID, MIDI, WAV
MIME::getAudioByExtension('oga');

// Programming languages specific checker
MIME::getCodeByExtension('php');

// Programming languages specific checker
MIME::getEbookByExtension('epub');

// Font specific checker
MIME::getFontByExtension('otf');

use Lkt\MIME;

// Check if MIME represents an image
MIME::isImage('png');

// Check if MIME represents audio
MIME::isAudio('mp3');

// Check if MIME represents video
MIME::isVideo('mp4');

// Check if MIME represents a font
MIME::isFont('ttf');

use Lkt\MIME;

MIME::PDF;
MIME::HTML;