c3systems/c3-sdk-php

此包已弃用且不再维护。未建议替代包。

PHP的C3 SDK

0.0.6 2018-09-29 07:49 UTC

This package is auto-updated.

Last update: 2022-06-21 15:47:14 UTC


README

C3 SDK for PHP

此SDK可用于WordPress。

安装

composer require c3systems/c3-sdk-php

使用方法

以下是一个hello world示例

require_once(__DIR__.'/../vendor/autoload.php');
use SDK\Client;
use SDK\Util;

class App {
  public $client;

  function __construct() {
    $this->client = new Client;
  }

  function setItem($key, $value) {
    $this->client->state()->set(Util::string2ByteArray($key), Util::string2ByteArray($value));
  }

  function getItem($key) {
    $result = $this->client->state()->get(Util::string2ByteArray($key));
    return Util::byteArray2String($result->value);
  }
}

$app = new App;
$app->client->registerMethod('setItem', ['string', 'string'], array($app, 'setItem'));
$app->client->registerMethod('getItem', ['string'], array($app, 'getItem'));
$app->client->serve();

测试

make test

许可证

MIT