pingleware/web3
最新稳定版本:1.0.0.1
Composer 安装命令:
composer require pingleware/web3
包简介
PHP library for Web3
README 文档
README
A minimal Web3 composer library for interacting with a blockchain including GANACHE.
Prerequisites
The following packages must be installed prior to use,
PHP 7.8,
sudo apt install php
CURL,
sudo app install curl
pingleware-deploy-cli
sudo snapcraft install pingleware-deploy-cli
if using the executables in the bin path, ensure the permissions are set properly,
sudo chmod +x vendor/pingleware/web3/bin/pingleware-deploy-cli*
Sample code
require "vendor/autoload.php";
use PINGLEWARE\Web3\Web3;
$web3 = null;
$arch = Web3::detectArchitecture();
$os = strtolower(PHP_OS);
if ($arch == "ARM") {
$web3 = new Web3("http://192.168.0.103:8545",dirname(__FILE__)."/pingleware-deploy-cli_$os-arm64");
} else if ($arch == "x64") {
$web3 = new Web3("http://192.168.0.103:8545",dirname(__FILE__)."/pingleware-deploy-cli_$os-x64");
} else {
echo "architecture is UNKNOWN?\n";
exit;
}
echo 'Balance: '.$web3->eth_getBalance("0x5EaF72deD2e4E255C228f9070501974D3572c5d4")." ETH\n";
command to execute,
php -f index.php
results,
Balance: 997.34654526537 ETH
Contract Address: 0x4106fC344F17e207bAf7aF3B8CDB6325724F6fb8
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: CC-BY-4.0
- 更新时间: 2023-09-12