Http connector for steemit [php-graphene-node-client v3.0.2]

Words
75
Reading
1 min
Listen
Play
9y

php-graphene-node-client
It is PHP API client for Steem/GOLOS blockchain

Github or packagist with MIT license. Author t3ran13@t3ran13 and active helper semasping@semasping

In Release v3.0.2

  • new Http connection
  • SteemitHttpConnector in InitConnector by default

Aсcording this post libraries need to use new endpoint and http/jsonrpc calls instead of websockets.

Usage example:
Let get account count in Steemit

use GrapheneNodeClient\Connectors\Http\SteemitHttpConnector;

$command = new GetAccountCountCommand(new SteemitHttpConnector());

$commandQuery = new CommandQueryData();
$content = $command->execute($commandQuery);

var_dump($content);

If you use own connector witch extends WSConnectorAbstract()
You have to use new HttpConnectorAbstract()

<?php

namespace My\App;

use GrapheneNodeClient\Commands\DataBase\CommandAbstract;
use GrapheneNodeClient\Connectors\ConnectorInterface;

class MySteemitConnector extends HttpConnectorAbstract
{
    /**
     * @var string
     */
    protected $platform = self::PLATFORM_STEEMIT;

    /**
     * max number of tries to get answer from the node
     *
     * @var int
     */
    protected $maxNumberOfTriesToCallApi = 3;

    /**
     * https or http servers, can be list. First node is default, other are reserve.
     * After $maxNumberOfTriesToCallApi tries connects to default it is connected to reserve node.
     *
     * @var string|array
     */
    protected $nodeURL = ['https://api.steemit.com'];
}



Posted on Utopian.io - Rewarding Open Source Contributors

Http connector for steemit [php-graphene-node-client v3.0.2] | Ecency