PHPackages                             sevens/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. [Testing &amp; Quality](/categories/testing)
4. /
5. sevens/jsondb

ActiveLibrary[Testing &amp; Quality](/categories/testing)

sevens/jsondb
=============

Simple Php Test JSON Database; useful for development mode testing

v0.1.0(4y ago)045MITPHPPHP &gt;=8.0.0

Since Sep 21Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/temmyscope/jsondb)[ Packagist](https://packagist.org/packages/sevens/jsondb)[ RSS](/packages/sevens-jsondb/feed)WikiDiscussions master Synced 1w ago

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

About Seven JsonDB
------------------

[](#about-seven-jsondb)

- Simple PHP JSON database for development/testing workflows.
- Seven JsonDB is developed by Elisha Temiloluwa a.k.a TemmyScope.
- Built on the Seven Vars utilities for arrays and strings.

### Requirements

[](#requirements)

- PHP 8.4+
- Composer

#### Installation

[](#installation)

```
composer require sevens/jsondb
```

### Usage: Seven\\JsonDB\\JsonDB HOW-TO

[](#usage-sevenjsondbjsondb-how-to)

***Completely unit tested***

- Valid Input Sample

```
$data = [
   'name' => 'Random 1',
   'age' => 24, 'password' => 'gHAST_V43SS',
   'nickname' => 'dick & harry'
];
```

- Initialization

```
use Seven\JsonDB\JsonDB;

$db = JsonDB::init($directory, $database);

$table = JsonDB::init($directory, $database, $tblName);

//OR

$table = $db->setTable($tblName);
```

- Make database

\*\*\* Use this syntax to create a database \*\*\*

```
use Seven\JsonDB\JsonDB;

$newDB = JsonDB::make(string $directory, string $database): bool;
#returns true if successfully created
```

- Create Table

\*\*\* use this syntax to create a table \*\*\*

```
$schema = [
	'name', 'email', 'password'
];
$table->createTable($table, $schema);

//To use the 'save' method, you need to use a schema when creating a table
```

***Note: id, createdAt and updatedAt are auto-generated fields but you can generate them as well***

- List all databases

\*\*\* Use this syntax to list all available databases \*\*\*

```
use Seven\JsonDB\JsonDB;

$newDB = JsonDB::list(string $directory): array;
#returns an array of databases found
```

- Count number of databases

\*\*\* Use this syntax to count number of available database \*\*\*

```
use Seven\JsonDB\JsonDB;

$newDB = JsonDB::count(string $directory): int;
#returns number of databases found
```

- Delete database

\*\*\* Use this syntax to delete a database \*\*\*

```
use Seven\JsonDB\JsonDB;

$newDB = JsonDB::delete($directory, $db): bool;
#returns true name if successfully deleted
```

- Empty a database; delete database content

\*\*\* Use this syntax to delete all contents from a database \*\*\*

```
use Seven\JsonDB\JsonDB;

$newDB = JsonDB::empty($directory, $db): bool;
#returns true on success
```

### Table Operations

[](#table-operations)

- Generate an Id

```
use Seven\JsonDB\Table;

$table->generateId(Table::TYPE_STRING || Table::TYPE_INT);

//default is Table::TYPE_STRING
```

- Get Last Insert Id

```
$table->lastInsertId();
```

- Save Data In the Table: Only works on tables that were created with schema

```
//$table->id = 1;
$table->name = 'Elisha Temiloluwa';
$table->email = 'Elisha@gmail.com';
$table->password = hash('SHA256', 'password');
$table->save();
```

- Insert Data In the Table

```
$table->insert([
	'email' => 'sammy@hotmail.com', 'name' => 'Sam Orji',
	'password' => hash('SHA256', 'passphr4s3'),
]);
```

- Find items in the table using certain conditions

```
$table->find([
	'email' => 'Elisha@gmail.com'
]);
```

- Find items in the table using id

```
$table->findById('38a92f92b1268c64');
```

- Find the first or last matching item

```
$table->first(['email' => 'Elisha@gmail.com']);
$table->last(['email' => 'Elisha@gmail.com']);
```

### Testing

[](#testing)

```
composer install
./vendor/bin/phpunit
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance53

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

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

1700d ago

### Community

Maintainers

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

---

Tags

jsontestdatabasedbengine

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[ubirak/rest-api-behat-extension

Rest Api Extension for Behat

41327.0k2](/packages/ubirak-rest-api-behat-extension)[fakerino/fakerino

Faker framework, for generate every kind of fake data for test, database seed, mock responses, other

12214.8k5](/packages/fakerino-fakerino)[sofa/eloquent-testsuite

Helpers for fast and reliable UNIT tests for your Eloquent Models with PHPUnit

10104.7k](/packages/sofa-eloquent-testsuite)[kielabokkie/jsonapi-behat-extension

Behat extension for testing JSON APIs

1516.5k](/packages/kielabokkie-jsonapi-behat-extension)

PHPackages © 2026

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