A PHP implementation of a rudimentary key/value server.

dblume dblume Update http to https in README.md b263275 @ 2023-03-16 08:11:11
.htaccess first commit 2016-09-10 20:25:26
LICENSE.txt first commit 2016-09-10 20:25:26
README.md Update http to https in README.md 2023-03-16 08:11:11
config.php.sample first commit 2016-09-10 20:25:26
index.php Use same order as the Python implementation. Newest first. 2016-09-13 08:21:27
README.md

Key Value Store PHP

kvs-php is a rudimentary key/value store written in PHP.

Getting the project

You can get a copy of this project by clicking on the ZIP or TAR buttons near the top right of the GitList web page.

If you're me, and you want to contribute to the repo, then you can clone it like so:

git clone ssh://USERNAME@dlma.com/~/git/kvs-php.git

Building it

  1. Ensure your server's version of PHP supports PDO and SQLite.
  2. Move config.php.sample to config.php, and replace replaceme with a passcode you choose.
  3. Optional: Use secure HTTP. I recommend getting a free SSL certificate from Let's Encrypt.

Using it

Here is a live instance that serves an index page. You can send a key to get a value like so:

https://kvs-php.dlma.com/?k=1Gxxxxxxxxxx

Special use case, here's how to get the value for the most-recently updated key of a list of keys. The list could contain any number of keys, but only one value will be returned.

https://kvs-php.dlma.com/?k=1Gxxxxxxxxxx,1Gxxxxxxxxxz

Here's the recipe for a cURL command to store a new value for a key:

curl --data "key=value&auth={authorization}" https://{url}

Here's the source code for a Roku channel client of such a service.

Trouble shooting

If you get the error "Exception : SQLSTATE[HY000] [14] unable to open database file", then PHP's owner probably doesn't match the directory's owner. You may be able to fix it by noting PHP's owner from phpinfo(), and then invoke "sudo chown phpowner:phpowner (appropriate_target)".

Is it any good?

Yes.

Licence

This software uses the MIT license.