PHPackages                             phoenix-robotix/php-json-toolkit - 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. phoenix-robotix/php-json-toolkit

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

phoenix-robotix/php-json-toolkit
================================

A simple php library to work with JSON data

0.7.0(9y ago)137[1 PRs](https://github.com/Phoenix-Robotix/php-json-toolkit/pulls)PHP

Since Jul 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Phoenix-Robotix/php-json-toolkit)[ Packagist](https://packagist.org/packages/phoenix-robotix/php-json-toolkit)[ RSS](/packages/phoenix-robotix-php-json-toolkit/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

php-json-toolkit
================

[](#php-json-toolkit)

A simple php library to work with JSON data.

[![Build Status](https://camo.githubusercontent.com/01b5303d7654b6ac78ec3872b6f4451a2052f72ea7946e2b233d55b9af430772/68747470733a2f2f7472617669732d63692e6f72672f50686f656e69782d526f626f7469782f7068702d6a736f6e2d746f6f6c6b69742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Phoenix-Robotix/php-json-toolkit)

Usage
=====

[](#usage)

Initialize an object to work with
---------------------------------

[](#initialize-an-object-to-work-with)

```
$json_toolkit = new PR_JSON_TOOL_KIT();
```

Get value of a key
------------------

[](#get-value-of-a-key)

```
$json_data = '{
	"a": 1,
	"b": {
		"c": 2,
		"d": 3
	}
}';
$value = $json_toolkit->get_value_of("a", $json_data);  //1
$value = $json_toolkit->get_value_of("e", $json_data);  //false
$value = $json_toolkit->get_value_of("b:c", $json_data);  //2
```

Get objects matching certain criteria
-------------------------------------

[](#get-objects-matching-certain-criteria)

```
$value = $json_toolkit->get_data(["c" => 2], ["d"], $json_data);  //[{"d" => 3}]
$value = $json_toolkit->get_data(["c" => 2], [], $json_data); //[{"c" => 2, "d" => 3}]
$value = $json_toolkit->get_data(["c" => 4], [], $json_data); //[]
```

Class
=====

[](#class)

PR\_JSON\_TOOL\_KIT

Properties
==========

[](#properties)

$data
-----

[](#data)

- Private
- Associative array
- Parsed JSON data to work with

$key\_separator
---------------

[](#key_separator)

- Private
- String
- The separator string to use for parsing a multi-level key.
    Ex:

```
//JSON Data:
{
	"a": 1,
	"b": {
		"c": 2,
		"d": 3
	}
}
```

To get the value of `"d"` from the above JSON data, the key will be passed as follows:
b\*\*{key\_separator}\*\*d

Methods
=======

[](#methods)

\_\_construct
-------------

[](#__construct)

\_\_construct (string $json\_string = '\[\]', string $key\_separator = ':')

- Public
- Constructor function
- Parameters
    1. $json\_string
        The JSON string to parse and use as the data source `($data)`
        Default value: `'[]'`
    2. $key\_separator
        The separator string to use for parsing a multi-level key
        Default value: `':'`
- Return values
    1. Returns nothing

get\_value\_of
--------------

[](#get_value_of)

public mixed get\_value\_of (string $key, string $json\_data="")

- Public
- Get value of a key from the json data
- Parameters
    1. $key
        The key to search for in the data source `($data)`
        The key may be a simple key `("key")` or a multi-level key where the keys are separated by the `$key_separator ("lvl_1:lvl_2:lvl_3")`
    2. $json\_data
        The JSON string to parse and use as the data source `($data)`
        If no string provided, then the data source initialized by the constructor function will be used.
- Return values
    1. Returns the value of the key on success
    2. Returns `false` if key not found

get\_data
---------

[](#get_data)

public array get\_data (array $search\_key\_values, array $return\_value\_of\_keys=\[\], string $json\_array="")

- Public
- Get an array of objects(or the values of specific keys of the objects) having a particular key=&gt;value pair out of an array of objects
- Parameters

1. $search\_key\_values
    An array containing the `key => value` pairs to search for
2. $return\_value\_of\_keys An array containing the keys whose values to be returned if a match found.
    If no key specified, then the entire matched objects will be returned.
3. $json\_array The JSON string to parse and use as the data source `($data)`If no string provided, then the data source initialized by the constructor function will be used.

- Return values

1. Returns an array containing the objects with required key value pairs of the matched objects
2. Returns an empty array `([])` if no match found

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Unknown

Total

1

Last Release

3632d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/604406?v=4)[Nataraj S M](/maintainers/nataraj)[@nataraj](https://github.com/nataraj)

---

Top Contributors

[![natarajsahoo](https://avatars.githubusercontent.com/u/7103868?v=4)](https://github.com/natarajsahoo "natarajsahoo (16 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phoenix-robotix-php-json-toolkit/health.svg)

```
[![Health](https://phpackages.com/badges/phoenix-robotix-php-json-toolkit/health.svg)](https://phpackages.com/packages/phoenix-robotix-php-json-toolkit)
```

PHPackages © 2026

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