yadakhov/json
Larablocks Analysis
yadakhov/json works with Laravel 5 (latest release v2.0.1, Dec 31, 2016), which reached end of life: no more fixes, even for security.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- Supports only Laravel 5, past end of life
- No release in the last 12 months (last: Dec 31, 2016)
- 21 downloads a month (needs 10,000)
- 16 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Dec 31, 2016.
- No releases in the last 12 months.
- First released: Jun 9, 2015.
- Monthly downloads: 21.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 29, 2026.
| Install | |
|---|---|
composer require yadakhov/json |
|
| Latest Version: | v2.0.1 |
| PHP: | >=5.6.0 |
| Laravel: | 5 |
| License: | MIT |
| Last Updated: | Dec 31, 2016 |
| Links: | GitHub · Packagist |
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
With Composer
$ composer require yadakhov/json
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
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
$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
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
PHP 5.4 for short array syntax.
This package uses illuminate/support for the array and string helpers.
Run tests
./vendor/bin/phpunit
Related Packages
Renders consistent HTTP JSON responses for API-based projects
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v2.0.1 | >=5.6.0 | ~5.0 | MIT | |
| v2.0.0 | >=5.4.0 | ~5.0 | MIT | |
| v1.0.2 | >=5.4.0 | ~5.0 | MIT | |
| v1.0.1 | >=5.4.0 | 5.1.* | MIT | |
| v1.0.0 | >=5.4.0 | 5.0.28 | MIT |