1. Go to this page and download the library: Download tetthys/wallet 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/ */
tetthys / wallet example snippets
use Tetthys\Wallet\Contracts\WalletInterface;
/** @var WalletInterface $wallet */
// Create a new address
$addr = $wallet->createAddress('customer:123');
// Validate
if (!$wallet->validateAddress($addr)) {
throw new \RuntimeException("Invalid address");
}
// Query balances
$spendable = $wallet->getAvailableBalance(); // "0.015"
$received = $wallet->getReceivedAmount($addr); // "0.010"
// Transfer to many
$txid = $wallet->transferMany(
[
['to' => 'addr1...', 'amount' => '0.004'],
['to' => 'addr2...', 'amount' => '0.001', 'memo' => 'invoice#42'],
],
[
'fee_rate' => 'fast',
'subtract_fee_from' => [0],
]
);