PHPackages                             wula/web3 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wula/web3

ActiveWula-extension[Utility &amp; Helpers](/categories/utility)

wula/web3
=========

Web3代理

v0.3.1(7y ago)030MITPHP

Since Jul 20Pushed 7y ago2 watchersCompare

[ Source](https://github.com/ninggf/wula_extension_web3)[ Packagist](https://packagist.org/packages/wula/web3)[ Docs](http://www.wulacms.com/)[ RSS](/packages/wula-web3/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Web3适配器
-------

[](#web3适配器)

为[sc0vu/web3.php](https://packagist.org/packages/sc0vu/web3.php)中的`Web3`提供一个简单的封装以适用于[wula/wulaphp](https://packagist.org/packages/wula/wulaphp).

### 安装

[](#安装)

`composer require wula/web3`

### 配置

[](#配置)

使用之前请配置文件: `conf/web3_config.php`:

```
    return [
        'etherscanKey'=>'your apiKey issued by https://etherscan.io/',
        'nodes'=>[
            'default' => [
                'url'=>'http://localhost:8545',
                'timeout'=>5,
                'startBlockId'=>10000,
                'fullTxData'=>true
            ],
            'otherServer'=>[
                'url'=>'http://www.nidefuwuqi.com:8545',
                'timeout'=>5
            ]
        ]
    ]
```

> 说明:
>
> - etherscanKey: API KEY
> - nodes: 节点
> - `url`: RPC服务器
> - `type`: 可选`proxy`或空,当为`proxy`时,使用[etherscan](https://etherscan.io/apis#proxy)代理.
> - `timeout`: 连接超时，单位秒
> - `startBlockId`: 从哪个区块开始同步数据，如果不设置则不会同步区块数据
> - `fullTxData`: 是否获取事务的详细数据

### 使用

[](#使用)

*获取web3实例并使用*:

```
    //连接默认（default）服务器
    $web3 = Web3Factory::newWeb3();
    //或者连接指定服务器
    $web3 = Web3Factory::newWeb3('otherServer');

    //1. 获取最新区块
    $block = $web3->getBlock();
    //2. 获取1000区块并包括详细信息
    $block = $web3->getBlock(QuantityFormatter::format(1000),true);
```

*开启同步*:

使用`artisan cron`命令执行`sync.php`：

`# php artisan cron -i3 extensions/wula/web3/sync.php`

> 每3秒同步一次.

### 事件

[](#事件)

每同步到一个区块数据时触发`ethereum\onBlockSynced`事件:

*参数说明*

> 1. `Web3 $web3` Web3 实例.
> 2. `blockNumber` 区块ID.
> 3. `stdClass $block` 区块数据或null,详见[eth\_getBlockByHash文档](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash).

### 感谢

[](#感谢)

本扩展使用了[sc0vu/web3.php](https://packagist.org/packages/sc0vu/web3.php)库,特此感谢.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~32 days

Total

4

Last Release

2760d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fbc94bdddaa037a7447b60ee88aa33d28275134ae727cdf29f7e6290e8aebd8?d=identicon)[ninggf](/maintainers/ninggf)

![](https://www.gravatar.com/avatar/2959562a1af0d0d5e86ea818ed9ecd32a9c518fac9192b0f67b016a10642daf8?d=identicon)[windywany](/maintainers/windywany)

---

Top Contributors

[![windywany](https://avatars.githubusercontent.com/u/1430771?v=4)](https://github.com/windywany "windywany (6 commits)")

---

Tags

ethereumweb3erc20

### Embed Badge

![Health badge](/badges/wula-web3/health.svg)

```
[![Health](https://phpackages.com/badges/wula-web3/health.svg)](https://phpackages.com/packages/wula-web3)
```

###  Alternatives

[kornrunner/ethereum-offline-raw-tx

Pure PHP Ethereum Offline Raw Transaction Signer

63192.1k22](/packages/kornrunner-ethereum-offline-raw-tx)[kornrunner/solidity

Pure PHP implementation of Solidity

1940.5k11](/packages/kornrunner-solidity)[kornrunner/ethereum-token

PHP Ethereum Token Utils

1412.9k1](/packages/kornrunner-ethereum-token)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
