1. Go to this page and download the library: Download farbcode/laravel-evm library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
farbcode / laravel-evm example snippets
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]);
use Farbcode\LaravelEvm\Support\Receipt;
$receipt = $contract->wait('0xTxHash');
if (Receipt::isSuccessful($receipt)) {
// mined and did not revert
}