Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

opennetsys/c3-sdk-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

c3-sdk-php

The C3 SDK for PHP

This SDK can be used for WordPress.

Install

composer require c3systems/c3-sdk-php

Usage

Here's a hello world example

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

Test

make test

License

MIT