evought/data-uri

A convenient class for working with Data URIs in PHP.

v1.0 2015-02-03 22:28 UTC

This package is not auto-updated.

Last update: 2024-04-13 14:50:24 UTC


README

README.md

Eric Vought

2015-01-25 DataURI PHP library

#What This Project Is#

The DataUri class provides a convenient way to access and construct data URIs, but should not be relied upon for enforcing RFC 2397 standards.

This class will not:

  • Validate the media-type provided/parsed
  • Validate the encoded data provided/parsed

Examples of how to use the class are in FlyingTopHat's blog post, "Using Data URI's in PHP".

#Source and History#

DataURI is a class originally written by FlyTopHat and was used as an example in a 2012 blog post and as a Gist.

In 2014, I forked the Gist in order to package it as a micro-library for use by Composer as a dependency in other projects. Using a Gist-based micro-library in composer requires creating a custom VCS-based repository in your composer.json. This is clunky but acceptable in an application but becomes difficult if the host project is itself used as a Composer-dependency because the custom repository definition is not (by design) included in the host project. The repository definition and package requirement must be repeated in each enclosing project--- effectively defeating the purpose of automatic dependency management.

So, in 2015, I forked my fork of DataURI, this time to move it to a full-fledged GitHub repository so that it could be made into an actual composer-managed library in the Packagist repository and the extra machinery needed to turn it into a production component could be added.

#Licensing#

All components are under an MIT license. FlyingTopHat added an MIT license to the original GIST on 2 February 2015 to clarify original license.