Steem-php-wrapper | To gain time for your projects

in #utopian-io8 years ago (edited)

  • What is the project about?

Repository

Steem-php-wrapper project has prepared codes to give you a speed in your new projects.

  • Technology Stack

Composer autoloader,

PHP

  • Explanation

in test folder, index.php getting the data, send it to url getter by using __construct

Url getter check the url and if something wrong, will give you an error if not, filter will get the property and seperate if link has come from api.steemjs.com or profile.json. One after, connector will check which one has arrived and run different codes to give a result.

Example filtering.php;

namespace phpwrapper;

class filtering
{
     public $filter,$filtered,$json_url;


    /**
     * filtering constructor.
     */
    public function __construct(){

        $new = new urlGetter();
        $this->filter = $new->url_router;
        $this->filtered = strtolower($this->filter);
        $this->trim_done = trim($this->filtered);
        // explode again //
        $this->explosive = explode("/", $this->trim_done);
            if ($this->explosive[2] == "steemit.com") {
                return $this->json_url = $this->filtered;
            }
            else {
                return $this->trim_done = $this->filtered;
            }

       }


}

Exampe connector.php;


namespace phpwrapper;

class Connector
{
    public $api_connector,$url_getter,$json_url;


    /**
     * Connector constructor.
     */
    public function __construct(){
        $url_bringer = new filtering();
        $this->url_getter = $url_bringer->filtered;
        $this->json_url = $url_bringer->json_url;
    }


    /**
     * @return array
     */
    public function apiConnector () : array {

     if($this->json_url == null) {
         $api_connector = file_get_contents($this->url_getter);
         $api_connector = json_decode($api_connector, true);
         return $this->api_connector = $api_connector;
     }
    else{
        $ch = curl_init($this->json_url);
        curl_setopt($ch,CURLOPT_ENCODING , "");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $jsonString = curl_exec($ch);
        curl_close($ch);
        $user_details = json_decode($jsonString, true);
        return $this->api_connector = $user_details;
    }
    }

}

  • Roadmap

Adding api endpoints as an array to pick which one you will be working with.

  • How to contribute?

Feel free to contact with me on @utopian-io discord to contribute. As the project's nature, i am open for all contributions.

Image source



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved because it does not follow the Utopian Rules.

  1. Submitted projects must have a unique value. Redundant projects will not be accepted.
  2. Trivial code snippets, example code or simple templates will not be accepted.
  3. Low quality of code lead to rejection e.g. your test file has hard-coded H:\xampp\...

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

Hey @justyy, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Php gercekten cok kaliteli.

Coin Marketplace

STEEM 0.05
TRX 0.32
JST 0.082
BTC 62816.13
ETH 1674.13
USDT 1.00
SBD 0.41