notorious/bitsharesphp-ws

此软件包已废弃且不再维护。未建议替代软件包。

Bitshares的PHP WebSocket接口。

0.0.1 2018-06-13 08:05 UTC

This package is not auto-updated.

Last update: 2022-03-18 22:39:50 UTC


README

这是bitsharesjs-ws(纯PHP编写)的一个非常基本的实现。它可以用来轻松连接到Bitshares区块链并通过公共API或本地节点获取数据。

安装

使用Composer下载软件包

composer require notorious/bitsharesphp-ws

使用方法

市场API

app\BitsharesPHP\Example.php

<?php

namespace App\BitsharesPHP;

// Import the BitsharesClient class
use Notorious\BitsharesPHP\BitshareClient;

class Example {
  // Create local variable (Optional)
  private $client;
  
  function __construct() {
    // Instantiate the BitshareClient class instance 
    $this->client = new BitshareClient();
  }
  
  // Using CryptoBridge pairs, b-hash (HASH) and Bitcoin (BTC)
  public function echoMarketAPI() {
    //Grab the MarketAPI class instance from the client
    $market_api = $this->client->getMarketAPI();
    // Get Ticker Data
    echo $market_api->getTicker("BRIDGE.BTC", "BRIDGE.HASH");
    // Get Base Asset  => BRIDGE.BTC
    echo $market_api->getBase("BRIDGE.BTC", "BRIDGE.HASH");
    // Get Quote Asset => BRIDGE.HASH
    echo $market_api->getQuote("BRIDGE.BTC", "BRIDGE.HASH");
    // Get Lastest Price
    echo $market_api->getLatest("BRIDGE.BTC", "BRIDGE.HASH");
     // Get Current Lowest Bid
    echo $market_api->getLowestBid("BRIDGE.BTC", "BRIDGE.HASH");
     // Get Current Highest Bid
    echo $market_api->getHighestBid("BRIDGE.BTC", "BRIDGE.HASH");
     // Get Price Percent Change
    echo $market_api->getPercentChanged("BRIDGE.BTC", "BRIDGE.HASH");
     // Get Base Asset Volume
    echo $market_api->getBaseVolume("BRIDGE.BTC", "BRIDGE.HASH");
     // Get Quote Asset Volume
    echo $market_api->getQuoteVolume("BRIDGE.BTC", "BRIDGE.HASH");
  }
}

资产

Coming Soon

捐赠

喜欢这个项目?那么我也喜欢咖啡!如果你从这个项目中得到了帮助,请考虑给我买一杯咖啡!

  • BTC: 38DDHuLiRc2qLsksvEqujR7rBspBLwteSG
  • BCH: qp0xagl3cfxpjk26mxqvhkca4s6ws5a8cswg3kwyu9
  • ETH: 0xa8C90EF48D725fC17B53C7bFf952375eaD12A445
  • LTC: MQwhSbrY92nDyQAS9qobbTYYxh43n9nfNd

bitsharesphp-ws