farbcode / laravel-evm
Simple, Reliable Ethereum Integration for Laravel
Fund package maintenance!
farbcode
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/farbcode/laravel-evm
Requires
- php: ^8.4
- illuminate/contracts: ^11.0||^12.0
- kornrunner/ethereum-address: ^0.3.0
- kornrunner/keccak: ^1.1
- spatie/laravel-package-tools: ^1.16
- web3p/ethereum-tx: ^0.4.3
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
This package is auto-updated.
Last update: 2025-11-06 22:45:53 UTC
README
Laravel EVM (Ethereum Virtual Machine)
Simple, Reliable Ethereum Integration for Laravel
Features
- 💡 EIP-1559 Support: Seamlessly handle modern Ethereum transactions with dynamic fee management.
- 🚀 Asynchronous Transaction Queue: Process blockchain transactions safely through Laravel Queues — no blocking, no delays.
- 🔗 Event-driven Workflow: Stay in control with Laravel Events for every step: TxQueued, TxBroadcasted, TxMined, TxFailed.
- 🧠 Smart Nonce & Fee Strategy: Automatic nonce tracking and adaptive fee logic for consistent, reliable execution.
Documentation
All information on how to use this package can be found on our official documentation website. → Read the Docs
Requirements
- PHP >= 8.4
- Laravel >= 12
- GMP PHP extension installed and enabled
Installation
Install the package via composer:
composer require farbcode/laravel-evm
You can publish the config file with:
php artisan vendor:publish --tag="evm-config"
Then set your blockchain RPC URL, chain id and private key in .env:
EVM_CHAIN_ID=137 EVM_RPC_1=https://polygon-mainnet.g.alchemy.com/v2/KEY EVM_PRIVATE_KEY=0xabc123...64hex
Usage (Quick Glimpse)
use Farbcode\LaravelEvm\Facades\Evm; $abi = file_get_contents(storage_path('app/abi/MyContract.abi.json')); $contract = LaravelEvm::at('0xYourContract', $abi); // Read call $balance = $contract->call('balanceOf', ['0xUser']); // Write (async - enqueued on EVM_QUEUE default:evm-send, see https://laravel-evm.farbcode.net/basic-usage#writes-async-transactions for more information) $jobId = $contract->sendAsync('transfer', ['0xRecipient', 100]);
Wait for a known tx hash:
$receipt = $contract->wait('0xTxHash');
Log Filtering & Event Decoding
use Farbcode\LaravelEvm\Facades\EvmLogs; use Farbcode\LaravelEvm\Support\LogFilterBuilder; $abi = file_get_contents(storage_path('app/abi/ERC20.abi.json')); $logs = EvmLogs::query() ->fromBlock(18_000_000) ->toBlock('latest') ->address('0xToken') ->eventByAbi($abi, 'Transfer') ->topicAny(1, [LogFilterBuilder::padAddress($addrA), LogFilterBuilder::padAddress($addrB)]) ->get(); $decoded = array_map(fn($l) => LogFilterBuilder::decodeEvent($abi, $l), $logs);
All information on how to use this package can be found on our official documentation website. → Read the Docs
Changelog
Notable changes to this package are documented in our changelog for every new release.
Contributing
We welcome contributions to this package.
→ Read our Contribution Guidelines
License
The MIT License (MIT). See License File for more information.
Made with ❤️ by //farbcode.