PHP code example of ecourty / ethereum-php
1. Go to this page and download the library: Download ecourty/ethereum-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/ */
ecourty / ethereum-php example snippets
use EthereumPHP\Client\EthereumClient;
$client = new EthereumClient('http://localhost:8545');
// ...
$balance = $clent->getBalance('0x1234567890123456789012345678901234567890');
// ...
$latestBlock = $client->getLastBlock();
// ...
use EthereumPHP\Utils\EthereumConverter;
// ...
$weiAmount = 14500000789000000;
$etherAmount = EthereumConverter::weiToEther($weiAmount);
$gweiAmount = EthereumConverter::weiToGwei($weiAmount);
shell
composer