schnittstabil / json-decode-file
Read and decode JSON files
Installs: 1 348
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 2
Open Issues: 1
Requires
- php: >=5.6.0
- duncan3dc/bom-string: ^0.1.0 || ^0.2.0 || ^1.0
- kherge/file-manager: ^2.0
- seld/jsonlint: ^1.0
Requires (Dev)
- schnittstabil/phpunit-starter: ^6.0 || ^7.0
This package is auto-updated.
Last update: 2024-10-26 02:29:53 UTC
README
Read and decode JSON files
Handles UTF byte order marks (BOM), uses kherge/file-manager and seld/jsonlint to throw helpful File and JSON Exceptions respectively.
Install
$ composer require schnittstabil/json-decode-file
Usage
use function Schnittstabil\JsonDecodeFile\jsonDecodeFile; try { $json = jsonDecodeFile('composer.json'); } catch (\KHerGe\File\Exception\ResourceException $err) { echo $err->getMessage(), PHP_EOL; } catch (\Seld\JsonLint\ParsingException $err) { echo $err->getMessage(), PHP_EOL; }
Related
- load-json-file – Node.js version and inspiration of this projeject
License
MIT © Michael Mayer