PHP code example of forecho / web3

1. Go to this page and download the library: Download forecho/web3 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/ */

    

forecho / web3 example snippets


use Web3\Contracts\Ethabi;
use Web3\Contracts\Types\Address;
use Web3\Contracts\Types\Boolean;
use Web3\Contracts\Types\Bytes;
use Web3\Contracts\Types\DynamicBytes;
use Web3\Contracts\Types\Integer;
use Web3\Contracts\Types\Str;
use Web3\Contracts\Types\Uinteger;

$abi = new Ethabi([
    'address' => new Address(),
    'bool' => new Boolean(),
    'bytes' => new Bytes(),
    'dynamicBytes' => new DynamicBytes(),
    'int' => new Integer(),
    'string' => new Str(),
    'uint' => new Uinteger(),
]);

$abi->decodeParameter('uint', '0x0000000000000000000000000000000000000000000000000000000000000001');
// 1
$abi->decodeParameter('address', '0x0000000000000000000000000000000000000001');
// '0x0000000000000000000000000000000000000001'