PHPackages                             symbolist/piny-db - 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. symbolist/piny-db

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

symbolist/piny-db
=================

A tiny file-based JSON database for PHP with atomic locking, queue rotation, and optional TCP server.

v0.0.14(6mo ago)1272MITPHPPHP &gt;=7.4

Since Dec 5Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/Symbolist-Technology/piny-db)[ Packagist](https://packagist.org/packages/symbolist/piny-db)[ RSS](/packages/symbolist-piny-db/feed)WikiDiscussions main Synced today

READMEChangelog (6)DependenciesVersions (24)Used By (0)

 [![PineDB Logo](assets/piny-db-logo.svg)](assets/piny-db-logo.svg)

Tiny File-Based JSON Database for PHP

Install
-------

[](#install)

```
php composer.phar require symbolist/piny-db

```

Usage
-----

[](#usage)

**Start Server**

```
./vendor/bin/pinydb-server -h 127.0.0.1 -P 9999 -d ./piny-data

```

**Server CLI Options**

- `--host`, `-h` – Bind address (default: `127.0.0.1`).
- `--port`, `-P` – Port to listen on (default: `9999`).
- `--data-dir`, `-d` – Directory for table storage (default: current working directory + `/pinydb-data`).
- `--client-timeout`, `-t` – Socket timeout in seconds for client connections (default: `5`).
- `--logfile`, `-l` – Log file path (default: `/tmp/pinydb.log`).
- `--max-children`, `-m` – Maximum concurrent child processes when forking is available (default: `20`).
- `--disable-flock` – Skip file locking (useful on filesystems without `flock`).
- `--daemon` – Run the server as a background process (writes the PID to the pidfile).
- `--pidfile=PATH` – Override the pidfile location when using `--daemon` (default: `/tmp/pinydb.pid`).

**Use Client (Interactive Mode)**

```

./vendor/bin/pinydb-cli --host=127.0.0.1 --port=9999 ping

```

Example client Output

```
pinydb> ping
"PONG"
pinydb>

```

**Using PHP Client (SDK)**

```
use PinyDB\PinyDBClient;

try{
    $client = new PinyDBClient("127.0.0.1", 9999);

    echo $client->ping();  // PONG
    //$record = array('foo' => 'bar.'.rand(99,9999));
    //echo $client->insert('records', $record);  // PONG
    $record=  $client->rotate('records');
    print_r($record);
    exit;
}
catch(Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
    exit;
}
```

**Disabling file locks**

PinyDB uses `flock` for read and write operations by default. If you are working on a filesystem that does not support file locks (for example, some network mounts), you can disable locking:

```
use PinyDB\PinyDB;

$db = new PinyDB('/path/to/data', false); // disable flock
```

The TCP server can also skip locking via a flag:

```
./vendor/bin/pinydb-server --disable-flock -h 127.0.0.1 -P 9999 -d ./piny-data

```

Commands
--------

[](#commands)

```
  --help                        Show this help message
  -c                       Run a single command
  PING                          Test connection
  CREATE                 Create a new table
  DROP                   Drop a table
  COUNT                  Count rows in table
  ALL                    Get all rows
  GET                Get 1 row
  INSERT           Insert row
  PUSH             Push row to end
  UPDATE       Update row
  DELETE             Delete row
  SHOW TABLES                   List tables
  TRUNCATE               Remove all rows from table
  ROTATE                 Pop+rotate queue
  POP                    Pop queue
  RANDOM                 Randomly pop+rotate queue

```

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance69

Regular maintenance activity

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 93.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 ~2 days

Total

14

Last Release

181d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/59ff5f2c4e1b53a9b5449e39fdd262c905acecda2bc36b83894cb381d24549aa?d=identicon)[symbolist\_tech](/maintainers/symbolist_tech)

---

Top Contributors

[![i-tabu](https://avatars.githubusercontent.com/u/9974389?v=4)](https://github.com/i-tabu "i-tabu (30 commits)")[![jayeshyadav07](https://avatars.githubusercontent.com/u/76944410?v=4)](https://github.com/jayeshyadav07 "jayeshyadav07 (1 commits)")[![JayeshYadav07](https://avatars.githubusercontent.com/u/76944410?v=4)](https://github.com/JayeshYadav07 "JayeshYadav07 (1 commits)")

### Embed Badge

![Health badge](/badges/symbolist-piny-db/health.svg)

```
[![Health](https://phpackages.com/badges/symbolist-piny-db/health.svg)](https://phpackages.com/packages/symbolist-piny-db)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198741.5k12](/packages/pgvector-pgvector)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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