PHPackages                             nyankod/jsonfiledb - 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. nyankod/jsonfiledb

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

nyankod/jsonfiledb
==================

json database library for PHP

v0.3.0(9y ago)1234MITPHP

Since May 8Pushed 9y ago4 watchersCompare

[ Source](https://github.com/codepolitanlab/JsonFileDB)[ Packagist](https://packagist.org/packages/nyankod/jsonfiledb)[ Docs](https://github.com/nyankod/JsonFileDB)[ RSS](/packages/nyankod-jsonfiledb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (7)Used By (0)

JSON DB
=======

[](#json-db)

*Forked From philwc/JsonDB with many modifications*

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

**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 \nyankod\JsonDB('./data/');
$db->setTable('test');
$result = $db->select('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) }
}

```

The default extension is .json. If you want to use a different file extension as ".dat" or whatever, set it in second parameter when create object, `$db = new \nyankod\JsonDB('./data/', '.dat');`

---

### Method Overview

[](#method-overview)

**JsonDB -&gt; setTable ( "tablename" )** - Set tablename or create table file if not exist. This method have to always be called before doing data transaction.

**JsonDB -&gt; select ( "key", "value" )** - Selects multiple lines which contains the key/value and returns it as array

**JsonDB -&gt; selectAll ()** - Returns the entire file as array

**JsonDB -&gt; update ( "key", "value", ARRAY )** - Replaces the line which corresponds to the key/value with the array-data

**JsonDB -&gt; updateAll ( ARRAY )** - Replaces the entire file with the array-data

**JsonDB -&gt; insert ( ARRAY )** - Appends a row, returns true on success

**JsonDB -&gt; delete ( "key", "value" )** - Deletes all lines which corresponds to the key/value, returns number of deleted lines

**JsonDB -&gt; deleteAll ()** - Deletes the whole data, returns "true" on success

---

### Installation

[](#installation)

Just download the latest release and extract to your project, or using composer with package name `nyankod/jsonfiledb`.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.8% 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 ~180 days

Total

6

Last Release

3491d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/41c986b90f05292c5ea899027cc9809e14bc6b35cf7341509bed987b06e736ab?d=identicon)[yllumi](/maintainers/yllumi)

---

Top Contributors

[![yllumi](https://avatars.githubusercontent.com/u/404671?v=4)](https://github.com/yllumi "yllumi (17 commits)")[![philwc](https://avatars.githubusercontent.com/u/617110?v=4)](https://github.com/philwc "philwc (12 commits)")[![strzlee](https://avatars.githubusercontent.com/u/1794963?v=4)](https://github.com/strzlee "strzlee (2 commits)")

---

Tags

jsondatabasedb

### Embed Badge

![Health badge](/badges/nyankod-jsonfiledb/health.svg)

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

###  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.

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

Asynchronous PostgreSQL client for Amp.

110509.8k27](/packages/amphp-postgres)[rah/danpu

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

64401.8k10](/packages/rah-danpu)[alvin0/database-json-laravel

Create and manage json databases with Laravel

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

Restore missing foreign key constraints in the database.

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

PHPackages © 2026

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