alucari / phitflyer

phitFlyer, bitFlyer API PHP client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

phitFlyer, bitFlyer API PHP client

Description

phitFlyer is a PHP library which provides calling bitFLyer-API. It provides multiple access methods, such as array, class.

Feature

  • simple interface
  • return values are result of json decoding(array/object), but it also has object interface by using decorator class.
  • bundles benchmark class which can be used alternatively.

Demo

simple and fastest sample:

use PhitFlyer\PhitFlyerClient;

$client = new PhitFlyerClient();
 
$markets = $client->getMarkets();
 
foreach($markets as $idx => $market){
    echo $idx . '.' . PHP_EOL;
    echo 'product_code:' . $market->product_code . PHP_EOL;
    echo 'alias:' . (isset($market['alias']) ? $market['alias'] : '') . PHP_EOL;
}
 

objective access sample:

use PhitFlyer\PhitFlyerClient;
use PhitFlyer\PhitFlyerObjectClient;

$client = new PhitFlyerObjectClient(new PhitFlyerClient());
 
$markets = $client->getMarkets();
 
foreach($markets as $idx => $market){
    echo $idx . '.' . PHP_EOL;
    echo 'product_code:' . $market->getProductCode() . PHP_EOL;
    echo 'alias:' . $market->getAlias() . PHP_EOL;
}
 

benchmark sample:

use PhitFlyer\PhitFlyerClient;
use PhitFlyer\PhitFlyerBenchmarkClient;

$client = new PhitFlyerBenchmarkClient(
            new PhitFlyerClient(), 
            function ($m, $e) use(&$method, &$elapsed){
                 echo "[$m]finished in $e sec" . PHP_EOL;
             }
        );
 
$client->getMarkets();
 

logger client sample:

use PhitFlyer\PhitFlyerClient;
use PhitFlyer\PhitFlyerLoggerClient;

$client = new PhitFlyerLoggerClient(
    new PhitFlyerClient(),
    new YourLogger()    // YourLogger: Psr-3 compliant logger
);
$client->getNetDriver()->setVerbose(true);      // ouput detail log

using different net driver sample:

use PhitFlyer\PhitFlyerClient;
use NetDriver\NetDriver\Php\PhpNetDriver;

$client = new PhitFlyerClient();
$client->setNetDriver(new PhpNetDriver());      // use file_get_contents to call web api instead of cURL function

$markets = $client->getMarkets();

Usage

  1. create PhitFlyerClient object.
  2. call API method.
  3. PhitFlyer returns array or object(stdClass).

Requirement

PHP 5.5 or later

Installing phitFlyer

The recommended way to install phitFlyer is through Composer.

composer require stk2k/phitflyer

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

License

MIT

Author

stk2k

Disclaimer

This software is no warranty.

We are not responsible for any results caused by the use of this software.

Please use the responsibility of the your self.

Donation

-Bitcoin: 3HCw9pp6dSq1xU9iPoPKVFyVbM8iBrrinn

About

phitFlyer, bitFlyer API PHP client

License:MIT License


Languages

Language:PHP 100.0%