File-Based Key-Value Store for PHP.
A lightweight persistence layer for PHP scripts, cron jobs, and simple backend services. Stores data as JSON, making implementation trivial and portable.
One API, Everywhere. This library is part of the PolyKV ecosystem. Use the same consistent API across 12+ languages.
-
🐘 Native PHP No extensions required. Works on any standard PHP installation (7.4+).
-
📂 File-Backed Perfect for environments without a database (e.g., simple dashboard configurations, cache).
-
🔒 Lock Mechanism Implements basic file locking to prevent race conditions in CLI scripts.
composer require polykv/polykv<?php
require 'vendor/autoload.php';
use PolyKV\PolyKV;
$kv = new PolyKV("MyWebApp");
// 1. Save
$kv->setString('session_id', 'sess_abc');
$kv->setNumber('hits', 1);
// 2. Read
echo "Hits: " . $kv->getNumber('hits');
// 3. Update
$kv->setNumber('hits', $kv->getNumber('hits') + 1);
// 4. Delete
$kv->remove('session_id');
// 5. Clear All
$kv->clear();| Language | Verified Runtime (✅) | Build Only (🛠) |
|---|---|---|
| TypeScript | CLI (Node.js), Browser, React Native (iOS/Android) | - |
| Dart | Flutter (iOS/Android/macOS), CLI | - |
| Go | macOS, Linux, Windows, iOS, Android, CLI | - |
| Rust | macOS, iOS, Android, CLI | Linux, Windows |
| Swift | iOS, macOS, CLI | - |
| C++ | macOS, iOS, Android, CLI | - |
| Python | CLI, Web, Android | - |
| Kotlin | CLI, Web, Android | - |
| C# | CLI | Android, Windows |
| Java | CLI, Android | - |
| Ruby | CLI | - |
| PHP | CLI | - |
✅ Runtime Verified: Full CRUD operations verified via automated tests on actual devices/simulators.
MIT