PHPackages                             braincrafted/json - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. braincrafted/json

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

braincrafted/json
=================

v0.3(11y ago)216.1k6MITPHP

Since Apr 24Pushed 11y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (1)Versions (6)Used By (6)

Braincrafted\\Json
==================

[](#braincraftedjson)

> An object-orientated wrapper for json\_encode() and json\_decode() with error handling.

[![Build Status](https://camo.githubusercontent.com/6f2d12907c161339c5376a96dc5dab4e67d6fb36caaf12a35df4243082206916/68747470733a2f2f7472617669732d63692e6f72672f627261696e637261667465642f6a736f6e2e706e67)](https://travis-ci.org/braincrafted/json)

Developed by [Florian Eckerstorfer](https://florian.ec) in Vienna, Europe.

Installation
------------

[](#installation)

The recommended way of installing BraincraftedJson is through [Composer](http://getcomposer.org):

```
$ composer require braincrafted/json:@stable
```

***Tip:** You should replace `@stable` with the most recent version from the [releases](https://github.com/braincrafted/json/releases) page.*

Usage
-----

[](#usage)

```
use Braincrafted\Json\Json;
use Braincrafted\Json\JsonDecodeException;

// Encode a variable as JSON:
echo Json::encode(array('name' => 'Bilbo Baggins'));

// Decode JSON:
print_r(Json::decode('{"name": "Bilbo Baggins"}'));

// Decode JSON into an array:
print_r(Json::decode('{"name": "Bilbo Baggins"}', Json::DECODE_ASSOC));

// Error handling
try {
    Json::decode('{"name": "Bilbo Baggins"'); // missing }
} catch (JsonDecodeException $e) {
    echo sprintf("Could not decode JSON.\nReason: %s", $e->getMessage());
}
```

Changelog
---------

[](#changelog)

### Version 0.3 (18 November 2014)

[](#version-03-18-november-2014)

- Switched from PSR-0 to PSR-4
- Use `Json::DECODE_ASSOC` and `Json::DECODE_OBJECT` as second argument for `Json::decode()`

### Version 0.2 (15 November 2013)

[](#version-02-15-november-2013)

- Changed namespace to `Braincrafted`

License
-------

[](#license)

```
The MIT License (MIT)

Copyright (c) 2013 Florian Eckerstorfer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~143 days

Total

5

Last Release

4199d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a80f9fc61cd3a7d7779e8f120b458ca4d18fdd885d719bb77d3379b96bf714d9?d=identicon)[florianeckerstorfer](/maintainers/florianeckerstorfer)

---

Top Contributors

[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/braincrafted-json/health.svg)

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

###  Alternatives

[pkpass/pkpass

PHP PKPass class for iOS Wallet

9733.0M6](/packages/pkpass-pkpass)[craftcms/server-check

Craft CMS Server Check

694.1M2](/packages/craftcms-server-check)[marvinosswald/filament-input-select-affix

this input enables you to render a select next to an input in a seamless fashion

26126.1k1](/packages/marvinosswald-filament-input-select-affix)

PHPackages © 2026

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