fefas / jsoncoder
Json encoder and decoder as a class
v0.2.0
2018-01-13 22:48 UTC
Requires
- php: >=7.2
Requires (Dev)
- phpunit/phpunit: ^6.5
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2026-02-23 14:23:06 UTC
README
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