digiaonline / json-helpers
Exception-based wrappers for json_encode and json_decode
Installs: 57 303
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: ^6.4
This package is auto-updated.
Last update: 2023-03-12 20:49:41 UTC
README
Exception-based wrappers for json_encode and json_decode
Requirements
- PHP >= 7.0
Installation
composer require digiaonline/json-helpers
Usage
Encoding
<?php $data = [ 'foo' => 'bar' ]; try { $json = \Digia\JsonHelpers\JsonEncoder::encode($data); } catch (\InvalidArgumentException $e) { }
Decoding
<?php $json = '["foo":"bar"]'; try { $data = \Digia\JsonHelpers\JsonDecoder::decode($data); } catch (\InvalidArgumentException $e) { }
License
MIT