amashukov / eth-php
Standalone Ethereum / EVM SDK for PHP — Keccak-256, secp256k1 + ECDSA (RFC 6979), RLP, EIP-1559 offline signing, ABI calldata encoder, and an ethers.js-style JSON-RPC client. Umbrella package pulling the full pure-PHP EVM stack.
Requires
- php: >=8.3
- ext-bcmath: *
- ext-gmp: *
- amashukov/abi-encoder-php: ^0.1.0
- amashukov/eip1559-tx-signer-php: ^0.1.0
- amashukov/eth-rpc-client-php: ^0.1.0
- amashukov/keccak-php: ^0.1.0
- amashukov/rlp-php: ^0.1.0
- amashukov/secp256k1-php: ^0.1.0
Requires (Dev)
- amashukov/rector-php-rules: ^0.1.0
- friendsofphp/php-cs-fixer: ^3.50
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.0
- rector/rector: ^2.0
README
Pure-PHP Ethereum / EVM SDK — Keccak-256, secp256k1 ECDSA, RLP, EIP-1559 offline signing, ABI encoder, and an ethers.js-style JSON-RPC client in one composer require.
amashukov/eth-php is a standalone Ethereum / EVM SDK for PHP — a single umbrella package that pulls every EVM-side primitive you need: Keccak-256 / SHA-3 hashing, secp256k1 EC arithmetic with RFC-6979 low-S ECDSA, RLP encoding, EIP-1559 (Type-2) offline transaction signing, a Solidity ABI calldata encoder, and an ethers.js v6-style JSON-RPC client. Pure PHP, zero blockchain-library dependencies, no Symfony. It is the first maintained ethers.js-style PHP SDK with full EIP-1559 support.
Features
- Keccak-256 / SHA-3 — the hashing primitive every EVM selector and address derives from.
- secp256k1 + ECDSA — EC point arithmetic plus RFC-6979 deterministic, low-S signatures.
- RLP — recursive-length-prefix encoder / decoder for transactions and structures.
- EIP-1559 offline signing — assemble and sign Type-2 raw transactions without a node.
- ABI calldata encoder — Solidity ABI encoding that matches ethers.js byte-for-byte.
- ethers.js-style RPC client — JSON-RPC v6-style client with typed value objects over any PSR-18 transport.
- One install — the full EVM stack ships through a single
composer require.
Why amashukov/eth-php
web3p/web3.php is the historical PHP EVM client (~600★), but it is effectively abandoned and has no EIP-1559 (Type-2) support — it can only build legacy transactions, which most modern chains and tooling have moved past. amashukov/eth-php is the first maintained ethers.js-style PHP SDK with EIP-1559: deterministic low-S signing, an ABI encoder that matches ethers.js byte-for-byte, and a v6-style typed RPC client — each layer separately versioned, the whole stack behind one composer require.
Installation
composer require amashukov/eth-php
Usage
Each layer keeps its own namespace; import what you need:
use Amashukov\Keccak\Keccak; use Amashukov\AbiEncoder\AbiEncoder; use Amashukov\Eip1559TxSigner\Eip1559Signer; use Amashukov\EthRpc\EthRpcClient; use Amashukov\EthRpc\JsonRpcProvider; // Hash, encode calldata, sign a Type-2 tx, and broadcast it — see each // sub-package README for the full API.
The layers compose: the RPC client's getErc20Balance() builds its calldata through the ABI encoder, which derives selectors through Keccak — one consistent stack, no duplicated crypto.
Requirements
- PHP 8.3+
ext-gmp(bigint EC + wei math)ext-bcmath- A PSR-18 HTTP client + PSR-17 factories for the RPC client (e.g.
amashukov/http-client-php+nyholm/psr7)
Related packages
| Package | Layer |
|---|---|
| amashukov/keccak-php | Keccak-256 / SHA-3 |
| amashukov/secp256k1-php | secp256k1 EC arithmetic + ECDSA (RFC 6979, low-S) |
| amashukov/rlp-php | RLP encoder / decoder |
| amashukov/eip1559-tx-signer-php | EIP-1559 (Type-2) offline raw-tx assembly + signing |
| amashukov/abi-encoder-php | Solidity ABI calldata encoder (ethers.js-exact) |
| amashukov/eth-rpc-client-php | ethers.js v6-style JSON-RPC client + typed VOs over PSR-18 |
| amashukov/http-client-php | PSR-18 cURL HTTP client |
| amashukov/ton-php | Sister umbrella SDK for TON (The Open Network) |
| amashukov/blockchain-context-bundle | Symfony 7 bundle wiring the TON + EVM stacks |
Quality
- PHPStan level 9 across the whole stack.
- php-cs-fixer with the
@PER-CSruleset. - GitHub Actions CI on every push.
- Parity tests pin the ABI encoder and signed transactions byte-for-byte against ethers.js.
License
MIT — see LICENSE. Each bundled package is MIT-licensed in its own repository.