Skip to content

polykv/polykv-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PolyKV - PHP

Packagist License Stars Type

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.

✨ Why PolyKV PHP?

  • 🐘 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.

📦 Installation

composer require polykv/polykv

🚀 Usage

Complete Example

<?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();

🌍 Platform Support

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.

📜 License

MIT

About

Zero-Config, Native Key-Value Store for PHP

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages