library exceptional-json
JSON encoding and decoding that throws exceptions on failure
daverandom/exceptional-json
JSON encoding and decoding that throws exceptions on failure
- Friday, June 15, 2018
- by DaveRandom
- Repository
- 2 Watchers
- 18 Stars
- 19,961 Installations
- PHP
- 12 Dependents
- 0 Suggesters
- 1 Forks
- 1 Open issues
- 6 Versions
- 22 % Grown
Exceptional JSON
, (*1)
Thin wrapper around PHP's json_encode()
and json_decode()
functions, which throws exceptions when an operation fails., (*2)
Required PHP Version
Installation
$ composer require daverandom/exceptional-json
Usage
Call the \ExceptionJSON\encode()
and \ExceptionJSON\decode()
functions in exactly the same way as you would with
json_encode()
and json_decode()
. The only difference is that they will throw an exception if the operation fails., (*3)
Also defines json_try_encode()
and json_try_decode()
in the root namespace if they don't already exist, these are
simply aliases of their namespaced counterparts., (*4)
$encoded = \ExceptionJSON\encode($data);
$decoded = \ExceptionJSON\decode($encoded);
dev-master
9999999-dev
JSON encoding and decoding that throws exceptions on failure
Sources
Download
MIT
The Requires
The Development Requires
v1.0.4
1.0.4.0
JSON encoding and decoding that throws exceptions on failure
Sources
Download
MIT
The Requires
v1.0.3
1.0.3.0
JSON encoding and decoding that throws exceptions on failure
Sources
Download
MIT
v1.0.2
1.0.2.0
JSON encoding and decoding that throws exceptions on failure
Sources
Download
MIT
v1.0.1
1.0.1.0
JSON encoding and decoding that throws exceptions on failure
Sources
Download
MIT
v1.0.0
1.0.0.0
JSON encoding and decoding that throws exceptions on failure
Sources
Download
MIT