Practical overview
When it fits
Use it when a PHP application needs an Ethereum interface and the team wants built-in transaction, account, ABI and contract helpers.
Who it is for
- PHP developers building server-side software that needs Ethereum data or transactions.
- Teams integrating smart-contract calls, events or account utilities into PHP applications.
Documented uses
- Make Ethereum JSON-RPC calls and batch requests.
- Sign and send transactions, and work with accounts and messages.
- Encode and decode ABI data, call contracts, send contract transactions and retrieve filtered event logs.
- Convert blockchain numeric values and format ether denominations.
Requirements & limits
The repository presents Composer installation instructions and an MIT license.
- Requires PHP 7.4 or later and a configured Ethereum node endpoint for the documented connection pattern.
- The library supports read calls without setting personal account data, while sending transactions requires account address and private-key data.
- The README notes that most numeric call results are hexadecimal or BigNumber values and that many numeric inputs are expected as BigNumbers.
- The documented feature set includes batch calls, ABI v2, contract events and EIP-712 typed structured-data hashing.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install Simple-Web3-Php with Composer
Add the stable Simple-Web3-Php release to a PHP project.
Before you start
- PHP 7.4 or later
- Composer
Steps
From the project directory, run
composer require drlecks/simple-web3-php "^0.10.0".In PHP code, import
SWeb3\SWeb3and create an instance with an Ethereum node URL, for example:$sweb3 = new SWeb3('http://ethereum.node.provider:optional.node.port');
Expected outcome
The stable package is added through Composer, and PHP code can initialize the library's main Web3 object with a node URL.
Guide limitations
- The instance setup alone does not perform a blockchain request.
Read the Ethereum block number
Use an initialized Simple-Web3-Php instance to request the current block number.
Before you start
- PHP 7.4 or later
- Simple-Web3-Php installed with Composer
- An Ethereum node URL
Steps
Import
SWeb3\SWeb3and initialize it with an Ethereum node URL.Call
$res = $sweb3->call('eth_blockNumber', []);.If a numeric BigNumber representation is needed, import
SWeb3\Utilsand convert the result with$bigNum = Utils::hexToBn($res->result);.Convert the BigNumber to a readable string with
$s_number = $bigNum->toString();.
Expected outcome
The library requests the block number and, optionally, converts the returned hexadecimal result to a BigNumber and then a string.
Guide limitations
- The README notes that many calls return hexadecimal or BigNumber values and that most numeric parameters are expected as BigNumbers.
- A working Ethereum node connection is needed; node setup and error handling are not described.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 15 October 2026
- Original website title
- drlecks/Simple-Web3-Php · Official homepage title · retained in its source language

