PHPackages                             web3-php/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. [API Development](/categories/api)
4. /
5. web3-php/web3

AbandonedArchivedLibrary[API Development](/categories/api)

web3-php/web3
=============

Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.

66615.1k↓22.7%66[1 issues](https://github.com/web3-php/web3/issues)[1 PRs](https://github.com/web3-php/web3/pulls)1PHP

Since Feb 11Pushed 4y ago35 watchersCompare

[ Source](https://github.com/web3-php/web3)[ Packagist](https://packagist.org/packages/web3-php/web3)[ RSS](/packages/web3-php-web3/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (1)

 [![Web3 PHP](https://raw.githubusercontent.com/web3-php/art/master/editor-without-bg.png)](https://raw.githubusercontent.com/web3-php/art/master/editor-without-bg.png)

 [![GitHub Workflow Status (master)](https://camo.githubusercontent.com/20a2ac9e2ac5f181a972d8029a16ca642c17721bdae21da7527a39bb65f3d492/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f776562332d7068702f776562332f54657374732f6d6173746572)](https://github.com/web3-php/web3/actions) [![Total Downloads](https://camo.githubusercontent.com/bd6dbf7d8adedef1eed912c6a3a493b03241323d830ed9d21fbce76765362d06/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776562332d7068702f77656233)](https://packagist.org/packages/web3-php/web3) [![Latest Version](https://camo.githubusercontent.com/ebba3813f1698849e3460f73f514aa458f24fb450c5ec2f56065a70d3c0b80bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776562332d7068702f77656233)](https://packagist.org/packages/web3-php/web3) [![License](https://camo.githubusercontent.com/f79cd3e41674721a018a8a72fb2aac89dd268dbfbd1d96059969c9507f7835a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776562332d7068702f77656233)](https://packagist.org/packages/web3-php/web3)

---

**Web3 PHP** is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.

> This project is a work-in-progress. Code and documentation are currently under development and are subject to change.

Get Started
-----------

[](#get-started)

> **Requires [PHP 8.0+](https://php.net/releases/)**

First, install Web3 via the [Composer](https://getcomposer.org/) package manager:

```
composer require web3-php/web3 dev-master
```

Then, interact with a local (**[web3-php/cli](https://github.com/web3-php/cli)**) or remote ethereum node:

```
use Web3\Web3;

$web3 = new Web3('http://127.0.0.1:8545');

$accounts = $web3->eth()->accounts(); // ['0x54a3259f4f693e4c1e9daa54eb116a0701edc403', ...]
```

Usage
-----

[](#usage)

### `Web3` Namespace

[](#web3-namespace)

#### `clientVersion`

[](#clientversion)

The `clientVersion` method returns the version of the current client.

```
$web3->clientVersion(); // TestRPC v2.13.2
```

#### `sha3`

[](#sha3)

The `sha3` method hashes data using the Keccak-256 algorithm.

```
$web3->sha3('string'); // 0x348ab0847d053bb0150c1eb3470a71071d2967e20cf131b59dea3df9bf8f753e
```

### `Eth` Namespace

[](#eth-namespace)

#### `accounts`

[](#accounts)

The `accounts` method returns a list of addresses owned by this client.

```
$web3->eth()->accounts(); // ['0x54a3259f4f693e4c1e9daa54eb116a0701edc403', ...]
```

#### `chainId`

[](#chainid)

The `chainId` method returns the current chain id.

```
$web3->eth()->chainId(); // 1
```

#### `gasPrice`

[](#gasprice)

The `gasPrice` method returns the current price of gas in wei.

```
$web3->eth()->gasPrice()->toEth(); // 0.00000002
```

#### `getBalance`

[](#getbalance)

The `getBalance` method returns the balance of an address in wei.

```
$web3->eth()->getBalance('0x54a3259f4f693e4c1e9daa54eb116a0701edc403')->toEth(); // 100
```

#### `getBlockTransactionCountByHash`

[](#getblocktransactioncountbyhash)

The `getBlockTransactionCountByHash` method returns the number of transactions in a block by its hash.

```
$web3->eth()->getBlockTransactionCountByHash('0xd2a91777651a08b92d1d9fc701982c79da2249532cfe41a773a340978f96b5d1'); // 266
```

#### `getTransactionByHash`

[](#gettransactionbyhash)

The `getTransactionByHash` method returns information about a transaction by its hash.

```
$web3->eth()->getTransactionByHash('0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b');
```

#### `getTransactionReceipt`

[](#gettransactionreceipt)

The `getTransactionReceipt` method returns the receipt for a transaction by its hash.

```
$web3->eth()->getTransactionReceipt('0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0');
```

#### `getUncleCountByBlockHash`

[](#getunclecountbyblockhash)

The `getUncleCountByBlockHash` method returns the number of uncles in a block by its hash.

```
$web3->eth()->getUncleCountByBlockHash('0xd2a91777651a08b92d1d9fc701982c79da2249532cfe41a773a340978f96b5d1'); // 266
```

#### `hashrate`

[](#hashrate)

The `hashrate()` method returns the number of hashes-per-second this node is mining at.

```
$web3->eth()->hashrate(); // '65'
```

#### `isMining`

[](#ismining)

The `isMining()` method determines if the client is mining new blocks.

```
$web3->eth()->isMining(); // true
```

#### `blockNumber`

[](#blocknumber)

The `blockNumber()` method returns the number (quantity) of the most recent block seen by this client.

```
$web3->eth()->blockNumber(); // '3220'
```

#### `coinbase`

[](#coinbase)

The `coinbase()` method returns the Coinbase address of the client.

```
$web3->eth()->coinbase(); // '0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e'
```

#### `sendTransaction`

[](#sendtransaction)

The `sendTransaction` method creates, signs, and sends a new transaction to the network.

```
use Web3\ValueObjects\{Transaction, Wei};

$from = '0xc9257b94da7f8eb07537db73a4ad0603cd83aba4';
$to = '0x108d1089e4a737c0be63527a6e464564be948b03';
$value = Wei::fromEth('1');

$transaction = Transaction::between($from, $to)->withValue($value);

$web3->eth()->sendTransaction($transaction); // '0xa124a7de5177cf5cedd3c44e91d115d0011f915905fa36fb7c000a491fa536ee'
```

#### `submitWork`

[](#submitwork)

The `submitWork()` method submits a proof-of-work solution, and returns a boolean based on the result.

```
$web3->eth()->submitWork($nonce, $proofOfWorkHash, $mixDigest); // true
```

### `Net` Namespace

[](#net-namespace)

#### `listening`

[](#listening)

The `listening` method determines if this client is listening for new network connections.

```
$web3->net()->listening(); // true
```

#### `peerCount`

[](#peercount)

The `peerCount` method returns the number of peers currently connected to this client.

```
$web3->net()->peerCount(); // 230
```

#### `version`

[](#version)

The `version` method returns the chain ID associated with the current network.

```
$web3->net()->version(); // 1637712995212
```

---

Web3 PHP is an open-sourced software licensed under the **[MIT license](https://opensource.org/licenses/MIT)**.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 65.9% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/86cfef5c1f5195df1a9db17a5f8ecb34455e1f0133a725de9acf7f2fb26ac6a1?d=identicon)[nunomaduro](/maintainers/nunomaduro)

---

Top Contributors

[![nunomaduro](https://avatars.githubusercontent.com/u/5457236?v=4)](https://github.com/nunomaduro "nunomaduro (60 commits)")[![owenvoke](https://avatars.githubusercontent.com/u/1899334?v=4)](https://github.com/owenvoke "owenvoke (23 commits)")[![awebartisan](https://avatars.githubusercontent.com/u/29105478?v=4)](https://github.com/awebartisan "awebartisan (5 commits)")[![hammer-rot](https://avatars.githubusercontent.com/u/90797681?v=4)](https://github.com/hammer-rot "hammer-rot (1 commits)")[![NabiKAZ](https://avatars.githubusercontent.com/u/246721?v=4)](https://github.com/NabiKAZ "NabiKAZ (1 commits)")[![Xeath](https://avatars.githubusercontent.com/u/28760483?v=4)](https://github.com/Xeath "Xeath (1 commits)")

---

Tags

apiclientdappethethereumjson-rpcphpweb3

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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