PHPackages                             amostajo/php-json-array - 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. amostajo/php-json-array

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

amostajo/php-json-array
=======================

Simple class that extends the capabilities of the basic php \*array\* by adding json casting and file handling (read and write).

v1.0.0(10y ago)01821MITPHP

Since Dec 5Pushed 10y ago1 watchersCompare

[ Source](https://github.com/amostajo/php-json-array)[ Packagist](https://packagist.org/packages/amostajo/php-json-array)[ Docs](https://github.com/amostajo/php-json-array)[ RSS](/packages/amostajo-php-json-array/feed)WikiDiscussions v1.0 Synced 1mo ago

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

JSONArray (PHP class)
---------------------

[](#jsonarray-php-class)

[![Latest Stable Version](https://camo.githubusercontent.com/bbe4a302f4dfac533be385275ed0399c990043537d385738cf0741c05fcd52d4/68747470733a2f2f706f7365722e707567782e6f72672f616d6f7374616a6f2f7068702d6a736f6e2d61727261792f762f737461626c65)](https://packagist.org/packages/amostajo/php-json-array)[![Total Downloads](https://camo.githubusercontent.com/02cab35a0e70d941455b3d846a2d70ae854d4baf7e620bc020e6577817a34e93/68747470733a2f2f706f7365722e707567782e6f72672f616d6f7374616a6f2f7068702d6a736f6e2d61727261792f646f776e6c6f616473)](https://packagist.org/packages/amostajo/php-json-array)[![License](https://camo.githubusercontent.com/dae606750794256c9fdd23bedfadaa41935cb9cdc1e6b5125e273fe9a2d5b53f/68747470733a2f2f706f7365722e707567782e6f72672f616d6f7374616a6f2f7068702d6a736f6e2d61727261792f6c6963656e7365)](https://packagist.org/packages/amostajo/php-json-array)

Simple class that extends the capabilities of the basic php *array* by adding json casting and file handling (read and write).

Quick start
-----------

[](#quick-start)

- Clone or download the latest release.
- Via composer:

```
composer require amostajo/php-json-array
```

### Usage

[](#usage)

Creating an array:

```
$array = new JSONArray();
```

Add items as you normally would do using arrays:

```
$array[] = 'example';

$array['ID'] = 123;
$array['person'] = ['name' => 'John', 'lastname' => 'Doe'];
```

Casting:

```
// To JSON
echo $array->toJson();

// To string (casts to JSON at the end)
echo (string)$array;
```

Write to file:

```
// Writes array as json string into filename.
$array->write($filename);
```

Read from file:

```
// Reads from filename.
$array->read($filename);

// Use loaded array
echo $array[$key];
```

Coding Guidelines
-----------------

[](#coding-guidelines)

The coding is PSR-2.

License
-------

[](#license)

**JSONArray** is free software distributed under the terms of the MIT license.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity64

Established project with proven stability

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 ~0 days

Total

2

Last Release

3862d ago

### Community

Maintainers

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

---

Tags

phpjsonarray

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/amostajo-php-json-array/health.svg)

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

###  Alternatives

[zakirullin/mess

Convenient array-related routine &amp; better type casting

21330.0k2](/packages/zakirullin-mess)[hi-folks/data-block

Data class for managing nested arrays and JSON data.

1462.9k](/packages/hi-folks-data-block)

PHPackages © 2026

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