Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Evm Laravel Package

farbcode/laravel-evm

Simple, reliable Ethereum integration for Laravel with EIP-1559 fees, queued async transactions, nonce tracking, and events for every step from queued to mined. Requires PHP 8.4+ and ext-gmp.

View on GitHub
Deep Wiki
Context7

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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 11, 12 or 13
  • GMP PHP extension (ext-gmp) 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 = Evm::at('0xYourContract', $abi);

// Read call - integers come back as decimal strings
$balance = $contract->call('balanceOf', ['0xUser'])->as('uint256');

// 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. A receipt only proves inclusion, so check the status before treating it as a success:

use Farbcode\LaravelEvm\Support\Receipt;

$receipt = $contract->wait('0xTxHash');

if (Receipt::isSuccessful($receipt)) {
    // mined and did not revert
}

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.

→ See what's changed

Contributing

We welcome contributions to this package.

→ Read our Contribution Guidelines

→ Open an Issue

→ Submit a Pull Request

License

The MIT License (MIT). See License File for more information.


Made with ❤️ by //farbcode.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names