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

in #utopian-io7 years ago

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 [email protected]: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 '<pre>' . print_r($answer, true) . '<pre>';

//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 '<pre>' . print_r($answer, true) . '<pre>'; 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

Sort:  

I think this post was upvoted to 100% by mistake by utopian-io.

An explanation should be coming.

Yes, it was a mistake. @elear was logged in with the utopian account. He mistakenly voted on it with 100%. Here's the explanation: https://steemit.com/mistake/@elear/i-made-a-mistake

We are sorry this happened.

))) remove flags please.
I do not need anti-utopian)

@t3ran13 I asked @grumpycat to remove the downvote. If it is not removed within the cash out, I will send you the equivalent of 11% utopian voting power in liquid steem. Sorry for the mistake. At least you got some more followers ;p

Thanks for minut of my success)
I hope he will remove flag, it is better than money)

Hi . Im Rosa. I would like to know u more and be friends ?

This is likely a bug. There's even no comment from the bot.

it is soo awesome and do not need any comment! 80% sites in the world were made on PHP! https://haydenjames.io/80-percent-web-powered-by-php/

Haha. No, I mean that's how the utopian bot's supposed to work and this one's a deviation. A bug in the code. I wasn't talking anything about your post.

It is ok)
It was mine 1 minute of success

=)
it is ok, perhaps i am just lucky man)

Yes its needed more xplanation

i think bot is impressed, because 80% sites in the world are made with php. He just knows it and understend all importance of php client for steem blockchain! Clever bot)

Most likely!

No point in removing it though so I say, well done that man (lucky sod!)

This was my fault and I explain the reason here https://steemit.com/mistake/@elear/i-made-a-mistake. I am asking @grumpycat to remove the downvote.

@grumpycat
Why do not you like php?))

I want learn more, can you send me an email?

Hi . Im Rosa. I would like to know u more and be friends ?

what do you mean?
i am in steemit.chat with the same name

your post is very interesting, I like your post, because it can add insight to me, hopefully in the future can provide better postings, so I can know many things in my life, thank you very much. and also hopefully useful for other stemit friends.

What a nice vote keep it up,you can still make more of it

Hi . Im Rosa. I would like to know u more and be friends ?

Hi . Im Rosa. I would like to know u more and be friends ?

with pleasure

i think this is mistake from utopian bot ... because utopian never give upvote 100%
we will fixed this issue

Yes that true you clear the point and bring out the main point...comment and upvote @horlly

Php client is awesome!)

lol, are you aware that you have a working private posting key in your repository and now also on the steem blockchain and pushed to #1 trending post?

Show link pls

https://github.com/t3ran13/php-graphene-node-client/blob/664adc9c190bc455be6bbff16f66ebaf20bb6294/Debug/Test.php#L59

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

I got it from steemjs examples)
But anyway thank you!

haha, that's funny! So there's a free 20SP account donated by steemjs to be used by everybody - enjoy :)

edit: seems like this is known/intended:

[...] it doesn't matter as it's just posting private WIF of disposable accounts, having them hardcoded make easier for dev to test [...]

https://github.com/steemit/steem-js/pull/207

You cant without active posting key)

Holy fuck that's a big vote!

That whale has sank the Titanic .....with his vote!

Hi . Im Rosa. I would like to know u more and be friends ?

i am surprised=)

Hi @aggroed it's surely a mistake. maybe this will be changed when @elear wakes up.

cool, thx.

You're responding to a comment farmer.

A farmer must reply and respond to comments but it must be a meaningful comment..upvote and comment @horlly.

it does not matter)

Hi . Im Rosa. I would like to know u more and be friends ?

@t3ran13 no error. You have done everything. It a killer post. That should hit $1000, yes it should. A big welldone.

Hi . Im Rosa. I would like to know u more and be friends ?

Helo rosa. How are you. I am esther. How is everything generally.

will see)
I do not think so, because I'm dark horse here

Coin Marketplace

STEEM 0.22
TRX 0.27
JST 0.041
BTC 104435.36
ETH 3867.94
SBD 3.31