PHP code example of libero / media-type

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

    

libero / media-type example snippets


use Libero\MediaType\MediaType;

$mediaType = MediaType::fromString('text/html; Charset="utf-8"');

$mediaType->getEssence(); // 'text/html'
$mediaType->getParameters(); // ['charset' => 'utf-8']
(string) $mediaType; // 'text/html;charset=utf-8'