lajosbencz/geth-php

PHP wrapper for Geth JSON RPC

0.2.1 2017-09-14 10:13 UTC

This package is auto-updated.

Last update: 2024-04-12 03:19:31 UTC


README

PHP wrapper for Geth JSON-RPC

INSTALL

composer require lajosbencz/geth-php

USAGE

$geth = new \GethApi\GethApi([
        // Geth JSON-RPC version
        'version' => '2.0',
        // Host part of address
        'host' => '127.0.0.1',
        // Port part of address
        'port' => 8545,
        // Return results as associative arrays instead of objects
        'assoc' => true,
]);

$version = $geth->web3_getVersion();

$accounts = $geth->eth_accounts();
foreach($accounts as $account) {
    echo $account, ': ', $geth->eth_getBalance($account, 'latest'), PHP_EOL;
}

TODO

  • Parallel requests
  • Implement experimental PUB/SUB