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(4mo ago)1247MITPHPPHP &gt;=7.4

Since Dec 5Pushed 4mo 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 1mo ago

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

35

—

LowBetter than 80% of packages

Maintenance75

Regular maintenance activity

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 96.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

135d 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)")

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

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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