The project is to wrap the public utopian APIs in PHP Class. Technology Stack: PHP 7.0. 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
- Fork it!
- Create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am ‘Add some feature’
- Push to the branch: git push origin my-new-feature
- Submit a pull request 😀
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.
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: Being part of Utopian Moderating Team is Great ! (Intro Post)
Next Post: Adding Moderators Class to PHP Client of Utopian API