PHPackages                             mgleis/php-sqlite-key-value-store - 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. mgleis/php-sqlite-key-value-store

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

mgleis/php-sqlite-key-value-store
=================================

A PHP library that implements a key/value store with SQLite as the persistence layer.

1.0.3(4mo ago)013GPL-3.0-or-laterPHPPHP &gt;=7.4

Since Dec 4Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/mgleis/php-sqlite-key-value-store)[ Packagist](https://packagist.org/packages/mgleis/php-sqlite-key-value-store)[ RSS](/packages/mgleis-php-sqlite-key-value-store/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

PHP SQLite Key Value Store
==========================

[](#php-sqlite-key-value-store)

A PHP library that implements a key/value store with SQLite as the persistence layer.

Use it for small projects / prototypes with at most hundreds or thousands of values.

The library now includes RPC server and client capabilities for remote access over HTTP.

Install
-------

[](#install)

```
composer require mgleis/php-sqlite-key-value-store

```

Usage
-----

[](#usage)

### Basic Local Usage

[](#basic-local-usage)

```
$kv = new KeyValueStore();

```

### Set a Key

[](#set-a-key)

```
$kv->set('key', 'value');

```

### Get a Value by Key

[](#get-a-value-by-key)

```
$value = $kv->get('key');

```

### Check if a key exists

[](#check-if-a-key-exists)

```
$exists = $kv->has('key');

```

### Delete by Key

[](#delete-by-key)

```
$kv->delete('key');

```

### Search by Value

[](#search-by-value)

```
$arr = $kv->searchValueStartsWith('text');
$arr = $kv->searchValueContains('text');

```

### Search by Key

[](#search-by-key)

```
$arr = $kv->searchKeyStartsWith('text');
$arr = $kv->searchKeyContains('text');

```

RPC Server and Client
---------------------

[](#rpc-server-and-client)

### Starting an RPC Server

[](#starting-an-rpc-server)

You can expose your KeyValueStore via HTTP using the KeyValueStoreRpcServer:

```
use Mgleis\PhpSqliteKeyValueStore\KeyValueStoreRpcServer;

$server = new KeyValueStoreRpcServer('/rpc'); // Initialize server for route /rpc/*
$server->start();
```

This creates an HTTP server that accepts JSON-RPC requests at endpoints like:

- `POST /rpc/get` - Get a value
- `POST /rpc/set` - Set a key-value pair
- `POST /rpc/has` - Check if key exists
- `POST /rpc/delete` - Delete a key
- `POST /rpc/searchValueContains` - Search values containing text
- `POST /rpc/searchValueStartsWith` - Search values starting with text
- `POST /rpc/searchKeyContains` - Search keys containing text
- `POST /rpc/searchKeyStartsWith` - Search keys starting with text

### Using the RPC Client

[](#using-the-rpc-client)

Connect to a remote KeyValueStore server using the client:

```
use Mgleis\PhpSqliteKeyValueStore\KeyValueStoreRpcClient;

$kv = new KeyValueStoreRpcClient('http://myserver.de:8080/rpc');

// Use exactly like the local KeyValueStore
$kv->set('key1', 'value1');
echo $kv->get('key1');
echo $kv->has('key1');
$kv->delete('key1');

// Search operations work the same way
$arr = $kv->searchValueStartsWith('text');
$arr = $kv->searchValueContains('text');
$arr = $kv->searchKeyStartsWith('text');
$arr = $kv->searchKeyContains('text');
```

The client implements the same interface as the local KeyValueStore, making it a drop-in replacement for remote access.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance78

Regular maintenance activity

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~218 days

Total

3

Last Release

130d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/62cefaca0cce59f88d67d18a80b33ab15852c0d85ad76e7ce585553759917122?d=identicon)[plutus78](/maintainers/plutus78)

---

Top Contributors

[![mgleis](https://avatars.githubusercontent.com/u/3601371?v=4)](https://github.com/mgleis "mgleis (8 commits)")

### Embed Badge

![Health badge](/badges/mgleis-php-sqlite-key-value-store/health.svg)

```
[![Health](https://phpackages.com/badges/mgleis-php-sqlite-key-value-store/health.svg)](https://phpackages.com/packages/mgleis-php-sqlite-key-value-store)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

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

8351.6M87](/packages/propel-propel1)[yemenopensource/filament-excel

This package useful for importing excel files into models.

194.2k](/packages/yemenopensource-filament-excel)

PHPackages © 2026

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