Development And Debug Of php-graphene-node-client[Debugger sub-project]

php-graphene-node-client

It is PHP API client for Steem/GOLOS blockchain

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

Debugger

Sometimes you need checking of work some calls or debug them but you can't do you in the php-graphene-node-client library. To do it you need some project. Debugger was created for this goal - you can copy files to php-graphene-node-client library and develope/debug it on the fly (without install to any project).

Github

Install debugger

  • make cmd git clone git@github.com:t3ran13/php-graphene-node-client.git and copy files there (or if you have a project with php-graphene-node-client than make reserve copy and copy files there)
  • install docker
  • install docker-compose
  • cmd cd prodect_dir
  • run docker-compose project with cmd docker-compose up -d (to stop use docker-compose stop)
  • run from cmd docker-compose exec --user www-data php-fpm bash -c "composer install"

Remove debugger from project

  • cmd cd prodect_dir
  • cmd docker-compose down
  • delete all debugger files from project

Use

  • cmd cd prodect_dir
  • make some command call in Debug\Test.php
  • run docker
  • run docker project with cmd docker-compose up -d (to stop use docker-compose stop)
  • run from cmd docker-compose exec --user www-data php-fpm bash -c "php Debug/Test.php" and see answer

Examples Debug\Test.php

<?php


namespace GrapheneNodeClient\Debug;

use GrapheneNodeClient\Commands\CommandQueryData;
use GrapheneNodeClient\Commands\Login\GetApiByNameCommand;
use GrapheneNodeClient\Debug\Connectors\WebSocket\GolosWSConnector;
use GrapheneNodeClient\Debug\Connectors\WebSocket\SteemitWSConnector;
use GrapheneNodeClient\Debug\TestCommand;


ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
define('PATH', __DIR__ . '/..');
require __DIR__ . "/Autoloader.php"; // only in GrapheneNodeClient project
require __DIR__ . '/../vendor/autoload.php';



$command = new GetApiByNameCommand(new SteemitWSConnector());
$commandQueryData = new CommandQueryData();
$commandQueryData->setParams(
    ['follow_api']
);
$answer = $command->execute(
    $commandQueryData
);

echo '
' . print_r($answer, true) . '
';

//Or Broadcast Operation 

$answer = OpVote::doSynchronous(
    ConnectorInterface::PLATFORM_STEEMIT,
    'guest123',
    '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg',
    'firepower',
    'steemit-veni-vidi-vici-steemfest-2016-together-we-made-it-happen-thank-you-steemians',
    10000
);

echo '
' . print_r($answer, true) . '
'; die;

You can use Debug\TestCommand.php as Template for your own commands

<?php

// code as above
use GrapheneNodeClient\Debug\TestCommand;

$command = new TestCommand(new GolosWSConnector());
$commandQueryData = new CommandQueryData();
$commandQueryData->setParams(
    ['follow_api']
);
$command->execute(
    $commandQueryData
);


It is better with each commit

Commits were done by me

  • added commands debugger
  • Removed the .idea folder
  • README.md upd
  • WSConnectorAbstract.php upd / dockerfile-php7-fpm upd for broadcast testing / Test.php added upvote operation



Posted on Utopian.io - Rewarding Open Source Contributors

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center