PHPackages                             philwc/jsondb - 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. [Database &amp; ORM](/categories/database)
4. /
5. philwc/jsondb

ActiveLibrary[Database &amp; ORM](/categories/database)

philwc/jsondb
=============

Database using json

v0.2(9y ago)81533MITPHP

Since May 8Pushed 9y ago2 watchersCompare

[ Source](https://github.com/philwc/JsonDB)[ Packagist](https://packagist.org/packages/philwc/jsondb)[ Docs](https://github.com/philwc/JsonDB)[ RSS](/packages/philwc-jsondb/feed)WikiDiscussions master Synced 3w ago

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

JSON DB
=======

[](#json-db)

"Handle JSON-Files like a very, very simple DB. Useful for little ajax applications."

Example
-------

[](#example)

*test.json*

```
[
{"ID": 0, "Name": "Josef Brunzer", "Age": 43},
{"ID": 1, "Name": "Harald Beidlpraka", "Age": 34},
{"ID": 2, "Name": "Heinz Goschnfuada", "Age": 67},
{"ID": 3, "Name": "Gerald Ofnsacka", "Age": 43}
]

```

*test.php*

```
require '../vendor/autoload.php';
$db     = new \philwc\JsonDB('./data/');
$result = $db->select('test', 'Age', 43);
var_dump($result);

```

*result:*

```
array(2) {
    [0]=> array(3) { ["ID"]=> int(0) ["Name"]=> string(13) "Josef Brunzer" ["Age"]=> int(43) }
    [1]=> array(3) { ["ID"]=> int(3) ["Name"]=> string(15) "Gerald Ofnsacka" ["Age"]=> int(43) }
}
```

Method Overview
---------------

[](#method-overview)

```
JsonDB->select ( "table", "key", "value" ) //Selects multiple lines which contains the key/value and returns it as array
JsonDB->selectAll ( "table" ) //Returns the entire file as array
JsonDB->update ( "table", "key", "value", ARRAY ) //Replaces the line which corresponds to the key/value with the array-data
JsonDB->updateAll ( "table", ARRAY ) //Replaces the entire file with the array-data
JsonDB->insert ( "table", ARRAY ) //Appends a row, returns true on success
JsonDB->delete ( "table", "key", "value" ) //Deletes all lines which corresponds to the key/value, returns number of deleted lines
JsonDB->deleteAll ( "table" ) //Deletes the whole data, returns "true" on success
JsonDB->setPrettyOutput ( "table", bool ) //Set Pretty Output for json_encode
JsonDB->setJsonEncodeOptions ( "table", int ) //Set options for json_encode
JsonDB->setExtension( "newExtension" ) //Set the file extension to use
```

If you use only one json file to store data, you can also use the `JsonTable` Class:

```
$db     = new \philwc\JsonTable('./data/test.json');
$result = $db->select('Age', 43);
var_dump($result);
```

In this case, you don't have always to specify the table name.

Tests are located in /tests. Run `phpunit` to run.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~858 days

Total

2

Last Release

3581d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/617110?v=4)[Phil Wright- Christie](/maintainers/philwc)[@philwc](https://github.com/philwc)

---

Top Contributors

[![philwc](https://avatars.githubusercontent.com/u/617110?v=4)](https://github.com/philwc "philwc (18 commits)")[![strzlee](https://avatars.githubusercontent.com/u/1794963?v=4)](https://github.com/strzlee "strzlee (2 commits)")[![gamtiq](https://avatars.githubusercontent.com/u/1177323?v=4)](https://github.com/gamtiq "gamtiq (1 commits)")

---

Tags

jsondatabasedb

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/philwc-jsondb/health.svg)

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

###  Alternatives

[greg0/lazer-database

PHP library to use JSON files like flat-file database

28816.5k4](/packages/greg0-lazer-database)[arcanedev/laravel-settings

This package allows you to persists configs/settings for Laravel projects.

78138.5k6](/packages/arcanedev-laravel-settings)[amphp/postgres

Asynchronous PostgreSQL client for Amp.

109584.1k38](/packages/amphp-postgres)[rah/danpu

Zero-dependency MySQL dump library for easily exporting and importing databases

62414.3k11](/packages/rah-danpu)[alvin0/database-json-laravel

Create and manage json databases with Laravel

344.5k](/packages/alvin0-database-json-laravel)[craftcms/fix-fks

Restore missing foreign key constraints in the database.

1217.5k](/packages/craftcms-fix-fks)

PHPackages © 2026

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