PHP code example of terranc / erc20-php
1. Go to this page and download the library: Download terranc/erc20-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/ */
terranc / erc20-php example snippets
$eth = new \FurqanSiddiqui\Ethereum\Ethereum();
$infura = new \FurqanSiddiqui\Ethereum\RPC\InfuraAPI($eth, "PROJECT-ID", "PROJECT-SECRET");
$infura->ignoreSSL(); // In case Infura.IO SSL errors
$erc20 = new \FurqanSiddiqui\Ethereum\ERC20\ERC20($eth);
$erc20->useRPCClient($infura);
$usdt = $erc20->token("0xdac17f958d2ee523a2206206994597c13d831ec7");
var_dump($usdt->name());
var_dump($usdt->symbol());
var_dump($usdt->decimals());
var_dump($usdt->totalSupply());
var_dump($usdt->balanceOf($eth->getAccount("ETHEREUM-ADDRESS")));