PHPackages                             amashukov/eth-rpc-client-php - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. amashukov/eth-rpc-client-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

amashukov/eth-rpc-client-php
============================

Ethereum JSON-RPC client in pure PHP — raw eth\_\* mirror (EthRpcClient) + ethers.js v6-flavoured facade (JsonRpcProvider) over any PSR-18 client. Typed Value Objects (transaction + receipt bundle, block, fee data, fee history, logs), bigint-safe hex/decimal helpers.

v0.1.1(1w ago)0204↑92.3%1MITPHPPHP &gt;=8.3CI passing

Since May 24Pushed 1w agoCompare

[ Source](https://github.com/AndreyMashukov/eth-rpc-client-php)[ Packagist](https://packagist.org/packages/amashukov/eth-rpc-client-php)[ Docs](https://github.com/AndreyMashukov/eth-rpc-client-php)[ RSS](/packages/amashukov-eth-rpc-client-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (24)Versions (3)Used By (1)

amashukov/eth-rpc-client-php
============================

[](#amashukoveth-rpc-client-php)

Ethereum / EVM JSON-RPC client in pure PHP — raw `eth_*` mirror plus an ethers.js v6-style typed provider over any PSR-18 client, with EIP-1559 fee data.

[![CI](https://camo.githubusercontent.com/229e896bae64fd0e63bed020755d0cba170897839841d545f2adfc8c4fb038ea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416e647265794d617368756b6f762f6574682d7270632d636c69656e742d7068702f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4349)](https://github.com/AndreyMashukov/eth-rpc-client-php/actions)[![PHPStan L9](https://camo.githubusercontent.com/c800d43a22afcd298d5f9f85c6902cd93290965453bd68dce5a84db5d6754bef/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416e647265794d617368756b6f762f6574682d7270632d636c69656e742d7068702f7374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d5048505374616e2532304c39)](https://github.com/AndreyMashukov/eth-rpc-client-php/actions)[![Latest Version](https://camo.githubusercontent.com/aa4b49a851721b4c288889bcee9c217626ac80d99eb3e69ca56c32f39ac18cb1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d617368756b6f762f6574682d7270632d636c69656e742d706870)](https://packagist.org/packages/amashukov/eth-rpc-client-php)[![Downloads](https://camo.githubusercontent.com/eb38578726ac20243440d679429db382a3f1d4fd51b5a65355394718243afa38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616d617368756b6f762f6574682d7270632d636c69656e742d706870)](https://packagist.org/packages/amashukov/eth-rpc-client-php)[![PHP](https://camo.githubusercontent.com/e0f413f5d5bc0670d27388819b276fdd345b02bf5a5a9a4666b313c8d271d171/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f616d617368756b6f762f6574682d7270632d636c69656e742d7068702f706870)](https://packagist.org/packages/amashukov/eth-rpc-client-php)[![License](https://camo.githubusercontent.com/454f1380e7fdc3e95e8b50eb0bfe462d683b22de59e46c8eae61a10e3440584b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616d617368756b6f762f6574682d7270632d636c69656e742d706870)](LICENSE)[![Stars](https://camo.githubusercontent.com/94b3a668dc00d3115c0ad25642f2112028dd488075f3869fc95291049e96e4cc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f416e647265794d617368756b6f762f6574682d7270632d636c69656e742d7068703f7374796c653d736f6369616c)](https://github.com/AndreyMashukov/eth-rpc-client-php)

An **Ethereum JSON-RPC client in pure PHP** for any EVM chain, built on any [PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP client. Two layers: a raw `eth_*` mirror (`EthRpcClient`) for audit-grade hex parity with the wire, and an [ethers.js](https://docs.ethers.org/v6/) v6-flavoured facade (`JsonRpcProvider`) returning typed Value Objects — `EthereumTransaction`, `EthereumTxBundle`, `EthereumBlock`, `EthereumFeeData`, `EthereumFeeHistory`, `EthereumTransactionLog`. Wei values that exceed `PHP_INT_MAX` stay safe as decimal strings via `ext-gmp`, never lossy floats. EIP-1559 fee composition follows ethers.js (`maxFeePerGas = 2 × baseFee + tip`), and the provider gracefully handles real-world node quirks like Erigon's bare `0x` returns and missing `baseFeePerGas`.

Features
--------

[](#features)

- **Two layers, one transport** — `EthRpcClient` mirrors the `eth_*` namespace (`eth_blockNumber`, `eth_getBalance`, `eth_call`, `eth_getTransactionByHash`, `eth_getTransactionReceipt`, `eth_getLogs`, `eth_feeHistory`, …); `JsonRpcProvider` wraps it with typed Value Objects and ethers.js naming.
- **Transport-agnostic** — bring your own PSR-18 client + PSR-17 factories. Retry / key-rotation / load-balancing are middleware concerns, not baked in.
- **Typed transaction surface** — `getTypedTransaction()` / `waitForTransaction()` return an `EthereumTxBundle` with EIP-658 `isStatusSuccess()` / `isStatusFail()` / `isStatusPending()` predicates, so call sites never compare raw `'0x1'` / `'0x0'` strings.
- **EIP-1559 fee data** — `getFeeData()` mirrors ethers.js (`maxFeePerGas = 2 × baseFee + tip`); `getFeeHistory()` carries the gwei-median math.
- **Node-quirk tolerant** — handles Erigon's bare `'0x'` empty returns and pre-London / missing-`baseFeePerGas` blocks without throwing.
- **Bigint-safe numeric helpers** — `Numeric\HexInt` / `HexBig` / `Wei`.
- **PSR-20 clock injection** — `waitForTransaction` deadlines are driven by an injected `Psr\Clock\ClockInterface`, so polling is fully testable.

Why amashukov/eth-rpc-client-php
--------------------------------

[](#why-amashukoveth-rpc-client-php)

`web3p/web3.php` is effectively abandoned and predates EIP-1559 — no typed fee data, no London-fork fee composition. This package targets modern PHP 8.3, ships EIP-1559 fee math out of the box, returns typed Value Objects with bigint-safe decimal strings, keeps PHPStan level 9 across the surface, and stays transport-agnostic so retries and API keys live in your PSR-18 pipeline.

Installation
------------

[](#installation)

```
composer require amashukov/eth-rpc-client-php
```

Usage
-----

[](#usage)

```
use Amashukov\EthRpc\EthRpcClient;
use Amashukov\EthRpc\JsonRpcProvider;
use Amashukov\HttpClient\CurlClient;
use Nyholm\Psr7\Factory\Psr17Factory;
use Symfony\Component\Clock\NativeClock;

$psr17 = new Psr17Factory();
$http  = new CurlClient($psr17, $psr17, timeoutSeconds: 30);

$client   = new EthRpcClient($http, $psr17, $psr17, 'https://your-eth-node.example/rpc');
$provider = new JsonRpcProvider($client, new NativeClock());

$balanceWei = $provider->getBalance('0xabc...');           // decimal string
$bundle     = $provider->getTypedTransaction('0xtxhash');  // EthereumTxBundle
if ($bundle->isStatusSuccess()) {
    $gasFee = $bundle->receipt->fee;                        // decimal wei
}

$fee  = $provider->getFeeData();                           // EthereumFeeData
$usdt = $provider->getErc20Balance('0xdAC17...', '0xholder...');
```

Wire a retry / API-key pipeline by composing [`amashukov/http-client-php`](https://github.com/AndreyMashukov/http-client-php)middlewares around the `CurlClient` and passing the resulting PSR-18 `Pipeline` into `EthRpcClient`.

### Two layers

[](#two-layers)

LayerUse it for`EthRpcClient` (`eth_*`)Audit-grade paths that need hex parity with the wire format.`JsonRpcProvider`New code — typed VOs, decimal-string balances, ethers.js naming.### Signing

[](#signing)

This package broadcasts already-signed raw transactions via `sendTransaction()`. Offline EIP-1559 / EIP-155 signing lives in the companion [`amashukov/eip1559-tx-signer-php`](https://github.com/AndreyMashukov/eip1559-tx-signer-php).

Requirements
------------

[](#requirements)

- PHP 8.3+
- `ext-gmp`, `ext-bcmath`
- A PSR-18 client + PSR-17 request / stream factories + a PSR-20 clock

Related packages
----------------

[](#related-packages)

PackageRole[amashukov/abi-encoder-php](https://github.com/AndreyMashukov/abi-encoder-php)Solidity ABI encode / decode (dependency)[amashukov/eip1559-tx-signer-php](https://github.com/AndreyMashukov/eip1559-tx-signer-php)Offline EIP-1559 / EIP-155 transaction signing[amashukov/http-client-php](https://github.com/AndreyMashukov/http-client-php)PSR-18 cURL client + retry / header-injection middleware[amashukov/keccak-php](https://github.com/AndreyMashukov/keccak-php)Keccak-256 hashing[amashukov/eth-php](https://github.com/AndreyMashukov/eth-php)Ethereum meta-package[amashukov/blockchain-context-bundle](https://github.com/AndreyMashukov/blockchain-context-bundle)Symfony bundle wiring the whole familyQuality
-------

[](#quality)

- **PHPStan level 9**, clean.
- **php-cs-fixer** `@PER-CS` ruleset.
- **GitHub Actions CI** on every push.
- Fee-composition parity checked against ethers.js v6 (`maxFeePerGas = 2 × baseFee + tip`).

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance98

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~8 days

Total

2

Last Release

8d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b3e86ca79a82515b23e0239b1d3616c747e59b64c40e169d538d5c759c9bbc4?d=identicon)[Andrey Mashukov](/maintainers/Andrey%20Mashukov)

---

Top Contributors

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

---

Tags

blockchaineip-1559ethereumethersevmjson-rpcphppsr-18phppsr-18json-rpcethereumweb3blockchainerc20evmetherssmart-contracteip-1559eth-rpcwei

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/amashukov-eth-rpc-client-php/health.svg)

```
[![Health](https://phpackages.com/badges/amashukov-eth-rpc-client-php/health.svg)](https://phpackages.com/packages/amashukov-eth-rpc-client-php)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k11](/packages/tempest-framework)[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.1B3.7k](/packages/guzzlehttp-psr7)[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

84735.1k](/packages/flow-php-flow)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35729.6k2](/packages/telnyx-telnyx-php)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

185671.3k41](/packages/laudis-neo4j-php-client)

PHPackages © 2026

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