PHP code example of neoncitylights / data-url
1. Go to this page and download the library: Download neoncitylights/data-url 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/ */
neoncitylights / data-url example snippets
use Neoncitylights\DataUrl\DataUrlParser;
use Neoncitylights\MediaType\MediaTypeParser;
$dataUrlParser = new DataUrlParser( new MediaTypeParser() );
$dataUrl = $dataUrlParser->parseOrNull( 'data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' );
print( $dataUrl->getMediaType()->getEssence() );
// 'text/plain'
print( $dataUrl->getData() );
// `VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==`
print( $dataUrl->getDecodedValue() );
// 'The five boxing wizards jump quickly.'