Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Codaone/bitshares-php
BitShares php library
https://github.com/Codaone/bitshares-php
Last synced: 3 months ago
JSON representation
BitShares php library
- Host: GitHub
- URL: https://github.com/Codaone/bitshares-php
- Owner: Codaone
- License: mit
- Created: 2019-08-24T12:33:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-21T05:12:03.000Z (about 4 years ago)
- Last Synced: 2024-08-04T03:03:20.911Z (6 months ago)
- Language: PHP
- Size: 19.5 KB
- Stars: 5
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-bitshares - bitshares-php - A php library, for reading bitshares blockchain (Libraries / PHP Libraries)
README
BitShares PHP Library
========Overview
---
This package allows you to read from BitShares network from selected BitShares node.
Package does not contain signing operations so any operation which needs signing does not work.Installation
---
```
composer require codaone/bitshares-php
```Requirements
---
* PHP >= 7.0Examples
===
BitShares class
---
All methods are passed as rpc meh```php
$bitShares = new BitShares('wss://node.com');
$block = $bitShares->getBlock('40385973');
$bitShares->getChainId();
```Getting data from named api
```php
$bitShares = new BitShares('wss://node.com');
$block = $bitShares->call('history', 'method_name', ['param1', 'param2']);
```Account
---
```php
$account = new Account('account-name');
$openorders = $account->getOpenOrders();
foreach($openorders as $order) {
...
}
```Market
---
```php
$market = new Market('BTS/USD'); // delimiter can also be : _ -
$market->getVolume24h('BTS')->getAmount();
$market->getTicker();
$market->getOrderBook(25)->getAsks();
```Asset
---
```php
$asset = new Asset('BTS');
$asset->getId(); // 1.3.0
$asset->getPrecision(); // 5
```General
---
Every class under Component namespace extends Object class which is iterable and has arrayAccess.
This means that for example these are possible:```php
$market = new Market('BTS/USD');
$market->getBase()->getSymbol(); // BTS
$market['base']['symbol]; // BTS
``````php
$account = new Account('account-name');
$account->getData('owner/weight_threshold');
$account['owner']['weight_threshold'];
$account->getBalances(); // returns balances array
$account->getData('balances/0/asset_type');
$account['balances'][0]['asset_type'];
foreach($account as $key => $value) {
...
}
```Contributing
---
Feel free to open pull requests or add an issueLicense
---
A copy of the license is available in the repository's [LICENSE](LICENSE.txt) file.