pxgamer/json-g

A PHP implementation of JSON-G.

v2.0.3 2017-12-07 00:00 UTC

README

Latest Version on Packagist Software License Build Status Style CI Code Coverage Total Downloads

A PHP implementation of JSON-G.

Structure

resources/
src/
tests/
vendor/

Install

Via Composer

$ composer require pxgamer/json-g

Usage

Use the JsonG::toImageBlob() or JsonG::toJson() to convert between a blob and JSON-G.

Examples

Converting an image via POST

$base64 = base64_decode($_POST['in']);

$image = new Imagick();
$image->readimageblob($base64);

$json = JsonG::toJson($image);

header("Content-Type: text/json");
echo $json;

Converting a JSON-G string to image via POST

$jsonArray = json_decode($_POST['in'], true);

$image = JsonG::toImageBlob($jsonArray);

header("Content-Type: image/png");
echo $image;

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email owzie123@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.