fefas/jsoncoder

Json encoder and decoder as a class

v0.2.0 2018-01-13 22:48 UTC

This package is auto-updated.

Last update: 2024-05-23 10:38:39 UTC


README

Build Status Build Status

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

Jsoncoder

Jsoncode is the result of I claiming by a way to encode, decode and whatever JSON using classes with error handling intead of awful functions.

Installation

Install it using Composer:

$ composer require fefas/jsoncoder

Usage

<?php

use Fefas\Jsoncoder\Json;

$json1 = Json::createFromString('{"field":"value"}'); // from a json string
$json2 = Json::create(['field' => 'anotherValue']); // from PHP values

echo $json1; // {"field":"value"}
echo $json2; // {"field":"anotherValue"}

$json1->decode(); // ['field' => 'value']
$json2->decode(); // ['field' => 'anotherValue']

$json1->isEqualTo($json2); // false