quantk / skv

SKV(Simple key-value) storage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SKV(Simple key-value) storage

Build Status codecov Scrutinizer Code Quality

This is simple implementation of Key-Value database(server and client) using php.

It's 100% covered with PHPUnit and Psalm was able to infer types for 100% of the codebase.

Created for educational purposes, so do not use it in production

Usage

Running server:

/usr/bin/php server.php

Client example:

<?php
declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use Amp\ByteStream;
use Amp\Loop;

Loop::run(static function () use ($argv) {
    $stdout = ByteStream\getStdout();

    $uri = 'tcp://127.0.0.1:31337';
    $client = new \Skv\Client\SkvClient(new \Skv\Client\Transport\Tcp\TcpTransport($uri));

    $response = (string)(yield $client->set('hello', 'world'));
    yield $stdout->write($response . PHP_EOL);

    $getResult = yield $client->get('hello');
    yield $stdout->write($getResult . PHP_EOL);
});

TODO

  • Base functional Server (Get/Set methods)
  • Base functional Client (Get/Set methods)
  • Base type support (string,null)
  • Psalm
  • Tests with phpunit
  • Array type

About

SKV(Simple key-value) storage


Languages

Language:PHP 100.0%