PHPackages                             yadakhov/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. [API Development](/categories/api)
4. /
5. yadakhov/json

ActiveLibrary[API Development](/categories/api)

yadakhov/json
=============

A simple wrapper class to work with json in PHP.

v2.0.1(9y ago)178.4k↓80%2MITPHPPHP &gt;=5.6.0

Since Jun 9Pushed 9y ago1 watchersCompare

[ Source](https://github.com/yadakhov/json)[ Packagist](https://packagist.org/packages/yadakhov/json)[ Docs](https://github.com/yadakhov/json)[ RSS](/packages/yadakhov-json/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (2)Versions (7)Used By (0)

[Json](http://github.com/yadakhov/json)
=======================================

[](#json)

[![Latest Stable Version](https://camo.githubusercontent.com/bc11a0e564beae7db38b861153423dc0abdc7e55bec860a2d14ebec507ca499e/68747470733a2f2f706f7365722e707567782e6f72672f796164616b686f762f6a736f6e2f76657273696f6e)](https://packagist.org/packages/yadakhov/json)[![License](https://camo.githubusercontent.com/c66ef0b285e2289962b07fa0bde313b11983cf4654a2fe45189f9e2f4287cbd4/68747470733a2f2f706f7365722e707567782e6f72672f796164616b686f762f6a736f6e2f6c6963656e7365)](https://packagist.org/packages/yadakhov/json)[![Build Status](https://camo.githubusercontent.com/69c324c2e9655ec2fb8f0d473596376197b9ef4ed7dc5daf57d4f35b6733b302/68747470733a2f2f7472617669732d63692e6f72672f796164616b686f762f6a736f6e2e737667)](https://travis-ci.org/yadakhov/json)

A simple wrapper class for working with Json.

Work with json as an object in PHP. Provides a simple api with dot notation for field access.

Use get() or set() to access any fields in the json structure.

```
require __DIR__.'/vendor/autoload.php';
use Yadakhov\Json;

$json = new Json(['status' => 'success', 'developer' => ['name' => 'Yada Khov']]);
echo $json;  // {"status":"success","developer":{"name":"Yada Khov"}}

$json->set('status', 'winning');
echo $json;  // {"status":"winning","developer":{"name":"Yada Khov"}}
```

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

[](#installation)

### With Composer

[](#with-composer)

```
$ composer require yadakhov/json

```

### Old fashion php

[](#old-fashion-php)

```
// download src/Json.php to your code folder..
require_once '/path/to/Json.php';

use Yadakhov/Json;

$json = new Json();
```

Usage: The Constructor
----------------------

[](#usage-the-constructor)

Will to accept array or json encoded string.

```
// There are 2 ways to instantiation a new Json object

// 1.
$json1 = new Json('{"status":"success"}');

// 2
$json2 = new Json(['status' => 'success']);
```

API functions
-------------

[](#api-functions)

```
$json->get('dot.notation') - get a field
$json->set('dot.notation', $value) - set a field
$json->toString() - return the Json object as a string
$json->toStringDot() - return the dot notation of the structure.
$json->toStringPretty() - json pretty print
$json->toArray() - return the array representation.
```

Design decision
---------------

[](#design-decision)

Internally, the json is stored as a PHP array. This allows us to use dot notation.

The left hand side of a json encoded string needs to be double quoted.

```
{
    "status": "success"
}
```

Dependencies
------------

[](#dependencies)

PHP 5.4 for short array syntax.

This package uses illuminate/support for the array and string helpers.

Run tests
---------

[](#run-tests)

```
./vendor/bin/phpunit

```

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 96.2% 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

3471d ago

Major Versions

v1.0.2 → v2.0.02016-12-31

PHP version history (2 changes)v1.0.0PHP &gt;=5.4.0

v2.0.1PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e2a2bbdfd6287c649a9759274fbd47d769ea78bf09b03ee3dcefe42790a95d4?d=identicon)[yadakhov](/maintainers/yadakhov)

---

Top Contributors

[![yadakhov](https://avatars.githubusercontent.com/u/146636?v=4)](https://github.com/yadakhov "yadakhov (75 commits)")[![jaakon](https://avatars.githubusercontent.com/u/612795?v=4)](https://github.com/jaakon "jaakon (3 commits)")

---

Tags

jsonapi

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[cloudcreativity/json-api-testing

PHPUnit test helpers to check JSON API documents.

141.7M4](/packages/cloudcreativity-json-api-testing)[wayofdev/laravel-symfony-serializer

📦 Laravel wrapper around Symfony Serializer.

2117.7k](/packages/wayofdev-laravel-symfony-serializer)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1119.1k1](/packages/dragon-code-laravel-json-response)

PHPackages © 2026

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