composer require weew/json-encoder
This is a very simple wrapper around the json_encode
and json_decode
functions that additionally supports various data types and provides catchable encoding & decoding exceptions in case of a JSON error.
$encoder = new JsonEncoder();
$encoder->encode(/** data **/);
$encoder->decode(/** json **/);