1. Go to this page and download the library: Download jay-nay/ost-kit-php-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jay-nay / ost-kit-php-client example snippets
ostkit\OstKitClient;
$ost = OstKitClient::create('YOUR-API-KEY', 'YOUR-API-SECRET');
// Create a user named 'Louise',
$user = $ost->createUser('Louise');
// ... and rename her to 'Liza'.
$user = $ost->updateUser($user['id'], 'Liza');
// Get information about a specific user, including its public address and token balance.
$user = $ost->getUser($user['id']);
// Get the token balance of a user.
$balance = $ost->getBalance($user['id']);
// Get the value of a user's token balance in BT, OST and USD.
$balance = $ost->getCombinedBalance($user['id']);
$btValue = $balance['available_balance'];
$ostValue = $balance['ost_value'];
$usdValue = $balance['usd_value'];
// List the full ledger of a user.
$transactions = $ost->getLedger($user['id']);
// List all users.
$users = $ost->listUsers(true);
// Create a user-to-user action that transfers an arbitrary amount of Branded Tokens to a user.
$action = $ost->createAction('BT fund transfer3', 'user_to_user', 'BT', null, 0.0);
// Update an action, the kind of an action is specified when it is created an cannot change.
// Change the action currency to 'USD', amount is still arbitrary and a commission of 1.5 percent will be charged.
// Commission charges can only be specified for user-to-user actions.
$action = $ost->updateAction($action['id'], null, $action['kind'], 'USD', null, 1.5);
// Get information about a specific action.
$action = $ost->getAction($action['id']);
// Lists some actions.
$actions = $ost->listActions(false);
// Execute an action.
$transaction = $ost->executeAction($action['id'], '2e6c0d8f-29b0-41fe-b7c0-83d9eb043fe1', '6c17aca7-9911-4dc0-8aa6-30dedae4d73d', 1);
// Get the information of an executed transaction.
$transaction = $ost->getTransaction($transaction['id']);
// List some transactions for the users in the array.
$transactions = $ost->listTransactions(false, array('id' => array('4e84c205-7da4-4547-b400-fa40e979227b')));
// Transfer some OST⍺ Prime (in Wei).
$transfer = $ost->transfer('0x495ed9A80b429C4A1eA678988ffBE5685D64fF99', 1);
// Retrieve a transfer.
$transfer = $ost->getTransfer('4073cd70-e4b8-44e9-96ad-871dd8c1e70f');
// List all transfers
$tansfers = $ost->listTransfers(true);
// more examples to come; have a look at the phpdoc in the meanwhile: https://realjaynay.github.io/ost-kit-php-client/ :)
bash
$ composer
"jay-nay/ost-kit-php-client": "dev-master"
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.