neoncitylights / data-url
Allows working with data URLs as entity objects in PHP
Fund package maintenance!
neoncitylights
Installs: 9 499
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 0
Open Issues: 2
Requires
Requires (Dev)
- mediawiki/mediawiki-codesniffer: 33.0.0
- mediawiki/minus-x: 1.1.0
- php-parallel-lint/php-console-highlighter: 0.5.0
- php-parallel-lint/php-parallel-lint: 1.2.0
- phpunit/phpunit: ^9.4
This package is auto-updated.
Last update: 2024-10-24 02:20:24 UTC
README
A small PHP library for dealing with data URLs, which contain a media type and an encoded base64 string.
This library fully conforms to RFC 23971.
Install
composer require neoncitylights/data-url
Usage
<?php use Neoncitylights\DataUrl\DataUrlParser; $dataUrlParser = new DataUrlParser(); $dataUrl = $dataUrlParser->parse( 'data:text/plain;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==' ); print( $dataUrl->getMediaType()->getEssence() ); // 'text/plain' print( $dataUrl->getData() ); // `VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg==` print( $dataUrl->getDecodedValue() ); // 'The five boxing wizards jump quickly.'
License
DataUrl is licensed under the MIT license.