承接 hkulekci/skytable-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hkulekci/skytable-php

Composer 安装命令:

composer require hkulekci/skytable-php

包简介

This library is a client for PHP that allows you to interact with the Skytable server.

README 文档

README

codecov

Skytable is an insanely fast, free and open-source, realtime NoSQL database that aims to provide flexible data modeling without compromising on performance or queryability — at scale.

This library is a client for PHP that allows you to interact with the Skytable server. It is very simple to use.

Here an example to create a connection for Skytable:

<?php
$connection = new \Skytable\Connection('127.0.0.1', 2003);

Skytable Client with Connection

Client requires a Connection to be created. Client have methods to send command to the client.

<?php
$connection = new \Skytable\Connection('127.0.0.1', 2003);
$client = new \Skytable\Client($connection);

Running Basic Commands

After creating a connection, you can use the client to run basic commands.

<?php

$response = $client->heya();
$response = $client->whereami();

You can find the list of commands inside the Client class docblock.

Running Multiple Commands

To run multiple command, you need to use ActionBuilder. Every command have their own class. You need to initialize the command and add it to the ActionBuilder as payload.

<?php
$builder = new ActionsBuilder();
$builder->add((new \Skytable\Action\Sys\Metric\Storage()));
$builder->add((new \Skytable\Action\Sys\Metric\Health()));

$response = $client->execute($builder);

Initial commands after connection

While creating a connection, you can also specify a callback to run first commands after connected :

$connection = new Connection('127.0.0.1', 2003, static function($connection) {
    $payload = new ActionsBuilder();
    $payload->add(new \Skytable\Action\Create\Table('queue', 'keymap(str, list<str>)'));
    $payload->add(new \Skytable\Action\Select('default:queue'));
});

Managing a Queue

To be able to create a queue, you need to create a table with the keymap model.

<?php

$skytable->create_table('queue', 'keymap(str,list<str>)');
$skytable->select('default:queue');

$skytable->lmod_push('queue', '1');
$skytable->lmod_push('queue', '2');
$skytable->lmod_push('queue', '3');
$skytable->lmod_push('queue', '4');

var_dump($skytable->lmod_pop('queue'));
var_dump($skytable->lmod_rpop('queue'));
var_dump($skytable->lget('queue'));

统计信息

  • 总下载量: 17
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 35
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 35
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固