PHPackages                             schnittstabil/json-decode-file - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. schnittstabil/json-decode-file

ActiveLibrary[File &amp; Storage](/categories/file-storage)

schnittstabil/json-decode-file
==============================

Read and decode JSON files

2.1.0(8y ago)31.4k2[1 issues](https://github.com/schnittstabil/json-decode-file/issues)1MITPHPPHP &gt;=5.6.0

Since Sep 26Pushed 7y ago1 watchersCompare

[ Source](https://github.com/schnittstabil/json-decode-file)[ Packagist](https://packagist.org/packages/schnittstabil/json-decode-file)[ RSS](/packages/schnittstabil-json-decode-file/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (4)Versions (7)Used By (1)

jsonDecodeFile [![Build Status](https://camo.githubusercontent.com/831ebc4e6dbb4cefab51617c499ed86abe37279f1bc363ece90339e65587be4d/68747470733a2f2f7472617669732d63692e6f72672f7363686e69747473746162696c2f6a736f6e2d6465636f64652d66696c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/schnittstabil/json-decode-file) [![Coverage Status](https://camo.githubusercontent.com/872a5f73adab942d3b6f9934a9c3824a83a227154d419b68cb490a3933936fdd/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7363686e69747473746162696c2f6a736f6e2d6465636f64652d66696c652f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/schnittstabil/json-decode-file?branch=master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/dd51008286e57479a9f0c46b98eb123cc35dfb6bb700377592e20ced3f8e8687/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7363686e69747473746162696c2f6a736f6e2d6465636f64652d66696c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/schnittstabil/json-decode-file/?branch=master) [![Code Climate](https://camo.githubusercontent.com/db4a61919ff93f36a3a59ba1bb581f2a744a1988546ae21897720775de465ac5/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7363686e69747473746162696c2f6a736f6e2d6465636f64652d66696c652f6261646765732f6770612e737667)](https://codeclimate.com/github/schnittstabil/json-decode-file)
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#jsondecodefile----)

[![SensioLabsInsight](https://camo.githubusercontent.com/73b02a8f8f7b3a41bd32900cce47239edf7a463e25e49f599395d558b530b16e/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f61346536353064342d363761382d343535362d613835662d6434663237643332333235392f6269672e706e67)](https://insight.sensiolabs.com/projects/a4e650d4-67a8-4556-a85f-d4f27d323259)

> Read and decode JSON files

[Handles UTF byte order marks (BOM)](https://github.com/duncan3dc/bom-string), uses [kherge/file-manager](https://github.com/kherge-php/file-manager) and [seld/jsonlint](https://github.com/Seldaek/jsonlint) to throw helpful File and JSON Exceptions respectively.

Install
-------

[](#install)

```
$ composer require schnittstabil/json-decode-file

```

Usage
-----

[](#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
-------

[](#related)

- [load-json-file](https://github.com/sindresorhus/load-json-file) – Node.js version and inspiration of this projeject

License
-------

[](#license)

MIT © [Michael Mayer](http://schnittstabil.de)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 90% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~136 days

Total

5

Last Release

3011d ago

Major Versions

1.1.0 → 2.0.02017-02-13

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6059032?v=4)[Michael Mayer](/maintainers/schnittstabil)[@schnittstabil](https://github.com/schnittstabil)

---

Top Contributors

[![schnittstabil](https://avatars.githubusercontent.com/u/6059032?v=4)](https://github.com/schnittstabil "schnittstabil (9 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

jsonjson\_decodevalidatorexceptionfiledecodeparseUTFbomfile\_get\_contents

### Embed Badge

![Health badge](/badges/schnittstabil-json-decode-file/health.svg)

```
[![Health](https://phpackages.com/badges/schnittstabil-json-decode-file/health.svg)](https://phpackages.com/packages/schnittstabil-json-decode-file)
```

###  Alternatives

[kherge/json

Encodes, decodes, and validates JSON data.

60234.2k6](/packages/kherge-json)[sven/file-config

Store and read configuration values using files on disk

2731.0k1](/packages/sven-file-config)[retrinko/ini

Library for parsing and writing INI files

1066.1k2](/packages/retrinko-ini)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
