PHP code example of amashukov / bitcoin-cash-php

1. Go to this page and download the library: Download amashukov/bitcoin-cash-php 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/ */

    

amashukov / bitcoin-cash-php example snippets


use Amashukov\CashAddr\CashAddress;
use Amashukov\CashAddr\CashAddrNetwork;
use Amashukov\BchnRpc\BchnRpcClient;
use Amashukov\BchnRpc\Vo\BchAmount;
use Amashukov\BchnRpc\Vo\PsbtOutput;

// Validate the destination, then build, sign and broadcast through the
// node — see each sub-package README for the full API.
$to = CashAddress::fromString($userInput, CashAddrNetwork::Mainnet);
if ($to->type->isTokenAware()) {
    // refuse or route to a token-aware flow
}
bash
composer