- Can I use this package in Laravel for EIP-1559 transaction signing without relying on external APIs like Infura?
- Yes, this package supports **offline EIP-1559 signing** (Type-2 transactions) entirely in PHP. You can generate and sign transactions locally without needing a JSON-RPC provider, making it ideal for cold wallets, enterprise DeFi, or air-gapped security. The SDK handles all cryptographic primitives (secp256k1, Keccak-256) natively.
- Does this work with Laravel’s built-in HTTP client (Guzzle) for JSON-RPC calls?
- Yes, the RPC client is **PSR-18 compliant**, so it integrates seamlessly with Laravel’s Guzzle-based HTTP client. No additional adapters are needed unless you’re using a non-Guzzle PSR-18 client. For custom transports, the package provides a typed interface for flexibility.
- What Laravel versions and PHP versions are officially supported?
- The package requires **PHP 8.3+** and is framework-agnostic, so it works with Laravel 10/11. If you’re on PHP 8.2 or lower, you may need to upgrade or use BCMath-only mode (though some features like secp256k1 may require `ext-gmp`). Always check the [Packagist dependencies](https://packagist.org/packages/amashukov/eth-php) for the latest requirements.
- How do I integrate this into Laravel as a service provider or package?
- Use Laravel’s **Service Provider** pattern: bind the SDK’s interfaces (e.g., `EthRpcClientInterface`) in your `register()` method, publish config files for RPC endpoints, and optionally create facades (e.g., `Eth::signTransaction()`). Example: `config['eth-php'] = ['rpc_url' => env('ETH_RPC_URL')];`. Follow the [Laravel Package Development](https://laravel.com/docs/packages) guide for best practices.
- Is there a Symfony dependency, or will it work cleanly in Laravel?
- This package is **Symfony-agnostic**—unlike `web3p/web3.php`, it avoids Symfony-specific abstractions, so it integrates smoothly into Laravel. The core SDK is a standalone library, and the RPC client uses PSR-18, which Laravel’s Guzzle already supports. No Symfony components are required.
- Can I use this for smart contract interactions (ABI encoding/decoding) like ethers.js?
- Yes, the **ABI encoder/decoder is byte-for-byte compatible with ethers.js v6**, ensuring correct calldata generation for Solidity functions. This makes it drop-in replaceable for any ethers.js workflow in Laravel, whether you’re calling `view` functions or encoding transaction inputs.
- What if my shared hosting doesn’t support `ext-gmp` or `ext-bcmath`? Are there workarounds?
- The package defaults to using `ext-gmp` for secp256k1 operations, but it includes a **BCMath fallback mode**. If neither is available, you’ll need to either: 1) enable the extensions on your hosting, 2) use a custom PHP build with `ext-gmp`, or 3) evaluate alternatives like `web3.php` (though it lacks EIP-1559). Test your environment with `php -m | grep -E 'gmp|bcmath'`.
- How do I handle private keys securely in Laravel with this package?
- Store private keys using Laravel’s **encryption facade** (`config['app.cipher']`) or environment variables (e.g., `ETH_PRIVATE_KEY`). For mnemonic phrases, use Laravel’s `Hash` facade to derive keys. Avoid hardcoding keys in config files. The SDK itself doesn’t manage key storage—it expects raw private keys or keypairs passed to signing functions.
- Are there any known limitations compared to alternatives like `web3p/web3.php`?
- This package is **the only maintained PHP SDK with EIP-1559 support**, but it’s less mature than `web3p/web3.php` (600+ stars). Key tradeoffs: 1) No legacy transaction support (only EIP-1559), 2) Requires PHP 8.3+, and 3) Lacks a large community. If you need legacy transactions or Symfony integration, `web3p/web3.php` (despite being abandoned) might still fit—but it won’t support EIP-1559.
- Can I use this for batch transactions or async RPC calls in Laravel?
- The RPC client supports **individual JSON-RPC calls**, but batch transactions require custom logic (e.g., bundling multiple calls into a single request). For async processing, offload RPC calls to Laravel **Queues** (e.g., `SendEthereumTransactionJob`) or use Laravel Horizon. The SDK itself doesn’t enforce batching, so you’ll need to implement it at the application level.