Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neoncitylights/php-data-url
PHP library for dealing with data URLs
https://github.com/neoncitylights/php-data-url
data-url php rfc-2397
Last synced: 2 days ago
JSON representation
PHP library for dealing with data URLs
- Host: GitHub
- URL: https://github.com/neoncitylights/php-data-url
- Owner: neoncitylights
- License: mit
- Created: 2020-10-26T04:12:02.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T01:36:23.000Z (5 months ago)
- Last Synced: 2024-08-08T19:14:42.260Z (3 months ago)
- Topics: data-url, php, rfc-2397
- Language: PHP
- Homepage: https://neoncitylights.github.io/php-data-url/
- Size: 119 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DataUrl
![Packagist Version](https://img.shields.io/packagist/v/neoncitylights/data-url)
![GitHub](https://img.shields.io/github/license/neoncitylights/php-data-url)
[![PHP Composer](https://github.com/neoncitylights/php-data-url/actions/workflows/php.yml/badge.svg)](https://github.com/neoncitylights/php-data-url/actions/workflows/php.yml)
[![codecov](https://codecov.io/gh/neoncitylights/php-data-url/branch/main/graph/badge.svg?token=IdWjeqFQcS)](https://codecov.io/gh/neoncitylights/php-data-url)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 2397[^rfc-2397].
## Install
```
composer require neoncitylights/data-url
```## Usage
```php
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](/LICENSE).[^rfc-2397]: Masinter, L., & X. (1998, August). The "data" URL scheme. Retrieved October 30, 2020, from