PHP Client of Utopian API

in #utopian-io7 years ago (edited)

PHP Client of Utopian API

  • What is the project about?
    The project is to wrap the public utopian APIs in PHP Class. I have seen @emrebeyler 's contribution on Python client, so I think it is a good idea to provide a PHP implementation.

  • Technology Stack
    PHP 7.0

  • Roadmap
    The next release will be adding more unit tests and more about moderators in terms of rewards, payout etc.

  • 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 :D

Installation and Usage

You just need to git clone the project and reference the unit

require('class.utopian.php');

Creating Instance

$utopian = new Utopian();

Getting a list of moderators

$moderators = $utopian->GetModerators()

Check if account is moderator type

if ($utopian->IsModerator('justyy')) echo "Hello, yes!";

Check if account is sponsor type

if ($utopian->IsSponsor('justyy')) echo "Hello, i am sponsor!";

Get List of Sponsors

print_r($utopian->GetSponsors());

Get Approved posts

foreach ($utopian->GetPosts() as $post) {
   // do something about $post;
}

Get a list of Hidden Posts

$flagged_posts = $utopian->GetPosts(array("status" => "flagged"));

Get count of approved contribution

echo "Total approved: " . $utopian->GetCount();

Get Post detail

var_dump($utopian->GetPost('justyy', 'string-contains-test-cannot-be-added-to-the-post'));

Check if bot is voting

if ($utopian->IsBotVoting()) {
 // ok write a post
}

Unit Tests

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



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

I haven't really get into utopian work. So far what i know is, it is good to the person who know programming. Rewards is actually awesome.

I dont about utopian, but I think so is very interesting.
For you @justyy, thanks for you support some my post.
Im very glad.

Thank you for the contribution. It has been approved.

Great Work with the client.

You can contact us on Discord.
[utopian-moderator]

Thank you!

Hey @justyy I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.19
TRX 0.14
JST 0.029
BTC 65771.81
ETH 3174.77
USDT 1.00
SBD 2.61