From ec92ef84b790c504ce216f4c2cc989891fad4557 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Fri, 15 Dec 2017 11:39:52 +0800 Subject: [PATCH] README.md --- README.md | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0c9e732..51bf5d3 100644 --- a/README.md +++ b/README.md @@ -6,21 +6,36 @@ A php interface for interacting with the Ethereum blockchain and ecosystem. # Install +``` +composer require sc0vu/web3.php dev-master +``` + +Or you can add this line in composer.json ``` -composer sc0vu/web3.php +"sc0vu/web3.php: "dev-master" ``` # Usage -### Web3 - -###### simple +### New instance ``` use Web3/Web3; $web3 = new Web3('http://localhost:8545'); +``` + +### Using provider +``` +use Web3/Web3; +use Web3\Providers\HttpProvider; + +$web3 = new Web3(new HttpProvider('http://localhost:8545')); +``` + +### You can use callback to each rpc call: +``` $web3->clientVersion(function ($err, $version) { if ($err !== null) { // do something @@ -34,11 +49,8 @@ $web3->clientVersion(function ($err, $version) { }); ``` -###### batch +### batch ``` -use Web3/Web3; - -$web3 = new Web3('http://localhost:8545'); $web3->batch(true); $web3->clientVersion(); $web3->hash('0x1234'); @@ -52,8 +64,24 @@ $web3->execute(function ($err, $data) { ``` ### Eth +``` +use Web3/Web3; -Todo +$web3 = new Web3('http://localhost:8545'); +$eth = $web3->eth; +``` + +Or + +``` +use Web3/Eth; + +$eth = new Eth('http://localhost:8545'); +``` + +# API + +Todo. # License MIT