PHP
Installation
ou can install the SDK using Composer:
composer require bitvora/bitvora-php
Usage
To use the SDK, initialize the BitvoraClient
with the appropriate API key and Network
enum (Network::MAINNET
or Network::SIGNET
), and then call the methods available for each endpoint.
Available Methods and Getters
1. Get Transactions
use Bitvora\Client\BitvoraClient;
use Bitvora\Enum\Network;
$client = new BitvoraClient(Network::MAINNET, 'API_KEY');
$transactionsResponse = $client->getTransactions();
$transactions = $transactionsResponse->all(); // Returns an array of TransactionResponse objects
foreach ($transactions as $transaction) {
echo $transaction->getId();
echo $transaction->getAmountSats();
echo $transaction->getStatus();
echo $transaction->getRailType();
}
Available Getters for TransactionResponse
:
$transaction->getId();
$transaction->getAmountSats();
$transaction->getRecipient();
$transaction->getStatus();
$transaction->getRailType();
$transaction->isSettled();
$transaction->isPending();
$transaction->isFailed();
$transaction->isPendingApproval();
$transaction->isRejected();
$transaction->isDeposit();
$transaction->isWithdrawal();
2. Get Withdrawal by ID
use Bitvora\Client\BitvoraClient;
use Bitvora\Enum\Network;
$client = new BitvoraClient(Network::MAINNET, 'API_KEY');
$withdrawalResponse = $client->getWithdrawal('withdrawal_id');
echo $withdrawalResponse->getId();
echo $withdrawalResponse->getAmountSats();
Available Getters for WithdrawalResponse
:
$withdrawal->getId();
$withdrawal->getAmountSats();
$withdrawal->getRecipient();
$withdrawal->getStatus();
$withdrawal->getRailType();
$withdrawal->isSettled();
$withdrawal->isPending();
$withdrawal->isFailed();