Adding Sponsors Class to PHP Client of Utopian API


The project PHP Client of Utopian API wraps the Utopian APIs and yesterday, the sub class Moderators has been added to the project, see Adding Moderator Class to PHP Client of Utopian API. Today, Sponsors have been added to the project so it is now very convenient to know, with a few lines of code, for example, the list of sponsors that are also witnesses or who opt-out receiving steem payout.

Github: PHP Client of Utopian API

Reload the Data (Sponsors)

This will re-fetch the data from Utopian API.

1
$sponsors->Reload();
$sponsors->Reload();

Raw Data (Sponsors)

1
$sponsors->GetRawData();
$sponsors->GetRawData();

Get a list of Sponsors

1
print_r($sponsors->GetList());
print_r($sponsors->GetList());

Get Total Number of sponsors

1
echo "there are " . $sponsors->GetTotal() . " sponsors.";
echo "there are " . $sponsors->GetTotal() . " sponsors.";

Find a Sponsor

1
2
$ned = $sponsors->GetSponsor('ned');
print_r($ned);
$ned = $sponsors->GetSponsor('ned');
print_r($ned);

Get Total Paid Rewards

1
echo "Total Paid Rewards: " . $sponsors->GetTotalPaidRewards();
echo "Total Paid Rewards: " . $sponsors->GetTotalPaidRewards();

Get Total of should_receive_rewards

1
echo "Should Receive Total: " . $sponsors->GetShouldReceiveRewards();
echo "Should Receive Total: " . $sponsors->GetShouldReceiveRewards();

Get Total Sum of total_paid_rewards_steem

1
echo "Steem: " . $sponsors->GetTotalPaidRewardsSteem();
echo "Steem: " . $sponsors->GetTotalPaidRewardsSteem();

Get Total Vesting by all sponsors

1
echo "Total Vesting by all sponsors: " . $sponsors->GetTotalVesting();
echo "Total Vesting by all sponsors: " . $sponsors->GetTotalVesting();

Get a list of Witnesses

1
2
3
foreach ($sponsors->GetListOfWitness() as $acc) {
   echo "Witness: " . $acc;
}
foreach ($sponsors->GetListOfWitness() as $acc) {
   echo "Witness: " . $acc;
}

Get Total of paid-rewards-steem

1
echo "Total Paid Rewards Steem: " . $sponsors->GetTotalPaidRewardsSteem();
echo "Total Paid Rewards Steem: " . $sponsors->GetTotalPaidRewardsSteem();

Get a list of Opted-out sponsors

1
2
3
foreach ($sponsors->GetListOfOptedOutSponsors() as $acc) {
   echo "Opted_out: " . $acc;
}
foreach ($sponsors->GetListOfOptedOutSponsors() as $acc) {
   echo "Opted_out: " . $acc;
}

How to contribute?

Github: https://github.com/DoctorLai/utopian-api-php-client

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am ‘Add some feature’
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request 😀

Unit Tests

The unit tests framework is phpunit and you can run tests via command phpunit.

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
476 words
Last Post: Adding Moderators Class to PHP Client of Utopian API
Next Post: How to Write Chrome Bookmark Scripts? - Step by Step Tutorial with a SteemIt Example

The Permanent URL is: Adding Sponsors Class to PHP Client of Utopian API

Leave a Reply