forecho / web3
一个用于与以太坊交互的PHP库
v1.2.0
2022-11-21 08:16 UTC
Requires
- php: ^7.1 || ^8.0
- ext-mbstring: *
- kornrunner/keccak: ~1.0
- phpseclib/phpseclib: ~3.0
Requires (Dev)
- phpunit/phpunit: ~6.0 || ~7.0 || ~8.0
README
PHP Ethereum ABI 编码/解码器
安装
然后
composer require forecho/web3
用法
编码
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'
许可证
MIT