Weave Code
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

Eth Php Laravel Package

amashukov/eth-php

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Ethereum/EVM Focus: The package is a pure-PHP, zero-dependency EVM stack, making it ideal for PHP applications requiring offline transaction signing (EIP-1559), ABI encoding, Keccak-256, and secp256k1 operations without relying on external services (e.g., Infura, Alchemy).
  • Modular Design: Each component (Keccak, secp256k1, RLP, ABI encoder, RPC client) is separately versioned but bundled under one composer require, reducing dependency sprawl.
  • Ethers.js Compatibility: The ABI encoder and RPC client are byte-for-byte compatible with ethers.js, ensuring consistency with modern Ethereum tooling.
  • Symfony Agnostic: While a Symfony bundle exists, the core SDK is framework-agnostic, making it suitable for Laravel, Lumen, or standalone PHP applications.

Integration Feasibility

  • Laravel Compatibility:
    • PSR-18 HTTP Client: Laravel’s built-in HTTP client (Guzzle) is PSR-18 compliant, so the RPC client integrates seamlessly.
    • No Symfony Dependencies: Unlike web3p/web3.php, this avoids Symfony-specific abstractions, reducing friction in Laravel.
    • Service Provider Pattern: Can be bootstrapped via Laravel’s Service Provider or Package Development (e.g., register() + boot()).
  • Offline Signing: The EIP-1559 signer enables air-gapped transaction signing, critical for security-sensitive applications (e.g., cold wallets, enterprise DeFi).
  • ABI Encoding: The ethers.js-compatible ABI encoder ensures correct calldata generation for smart contract interactions.

Technical Risk

  • PHP 8.3+ Requirement: May require minor PHP version upgrades if the app is on PHP 8.2 or lower.
  • GMP/BCMath Dependencies: Some shared hosting environments may lack ext-gmp or ext-bcmath, requiring server configuration changes.
  • Low Adoption (0 Stars): Lack of community validation introduces unproven reliability in production. Mitigation: Unit/integration tests against ethers.js parity tests.
  • RPC Client Abstraction: The typed RPC client is PSR-18-agnostic, but Laravel’s Guzzle may need adapters (e.g., amashukov/http-client-php if not using Guzzle).
  • EIP-1559 Complexity: Offline signing requires deep understanding of EIP-1559, increasing developer onboarding time.

Key Questions

  1. Does the application require EIP-1559 support?
    • If yes, this is the only maintained PHP SDK offering it.
    • If no, web3p/web3.php (legacy) or a lighter-weight alternative (e.g., web3.php fork) may suffice.
  2. Is ext-gmp/ext-bcmath available on the target PHP environment?
    • If not, evaluate fallback strategies (e.g., BCMath-only mode or custom extensions).
  3. Will the RPC client’s PSR-18 abstraction conflict with Laravel’s Guzzle?
    • Test with amashukov/http-client-php or implement a Guzzle adapter.
  4. What’s the fallback if the package lacks critical features?
    • Example: If batch transactions are needed, assess whether the RPC client supports them or if a custom solution is required.
  5. How will offline signing keys be managed?
    • Secure storage (e.g., Laravel’s encryption facade) and mnemonic/private key handling must be designed upfront.

Integration Approach

Stack Fit

  • Laravel Integration Points:
    • Service Provider: Register the SDK as a Laravel package with config publishing (e.g., RPC endpoints, network defaults).
    • Facades/Helpers: Wrap core functionality (e.g., Eth::signTransaction(), Eth::encodeABI()) for cleaner syntax.
    • Artisan Commands: Add CLI tools for offline signing (e.g., php artisan eth:sign --private-key=... --to=...).
    • Event Listeners: Hook into transaction lifecycle (e.g., broadcast events on successful RPC calls).
  • Database Models: Extend Eloquent models with EVM-specific traits (e.g., HasEthereumAddress, HasTransactionHash).
  • Queue Jobs: Offload RPC calls to Laravel Queues for async processing (e.g., SendEthereumTransactionJob).

Migration Path

  1. Phase 1: Core Integration
    • Install the package: composer require amashukov/eth-php.
    • Set up a Service Provider to bind interfaces (e.g., EthRpcClientInterface) to the SDK.
    • Replace existing Ethereum logic (e.g., web3.php) with the new SDK.
  2. Phase 2: Feature Parity
    • Implement ABI encoding for smart contract interactions.
    • Replace legacy transaction signing with EIP-1559.
    • Add Keccak hashing for address/selector derivation.
  3. Phase 3: Advanced Use Cases
    • Integrate offline signing into the app’s workflow (e.g., admin dashboard for cold wallet transactions).
    • Extend the RPC client with custom middleware (e.g., retry logic, rate limiting).
    • Add Symfony-style bundles (if needed) for tighter Laravel integration.

Compatibility

  • Laravel Versions: Tested on Laravel 10+ (PHP 8.3+). For older versions, may require backports or polyfills.
  • PSR-18 Clients: Works with Guzzle (Laravel default) or amashukov/http-client-php.
  • Existing Code: If using web3.php, rewrite transaction logic to use the new SDK’s typed RPC client.
  • Smart Contracts: ABI encoding is ethers.js-compatible, so OpenZeppelin/other contracts will work out-of-the-box.

Sequencing

Step Task Dependencies
1 Install package + PHP extensions (gmp, bcmath) PHP 8.3+
2 Create Laravel Service Provider None
3 Replace web3.php calls with SDK equivalents Existing Ethereum logic
4 Implement ABI encoding for contract interactions Smart contract ABIs
5 Add offline signing workflow Secure key storage
6 Test RPC client with Laravel HTTP client Guzzle/PSR-18 adapter
7 Deploy to staging + monitor CI/CD pipeline

Operational Impact

Maintenance

  • Pros:
    • Single Vendor: One composer require for the entire stack (vs. managing web3.php + custom crypto libraries).
    • MIT License: No legal restrictions on modification.
    • PHPStan L9: High code quality reduces runtime bugs.
  • Cons:
    • Low Adoption: No community support means bug fixes depend on the maintainer.
    • Breaking Changes: New EIPs (e.g., EIP-4844) may require manual updates.
  • Mitigation:
    • Fork the repo if critical fixes are needed.
    • Write integration tests to catch regressions.
    • Monitor GitHub issues for upstream changes.

Support

  • Documentation: README is technical but clear; sub-packages have separate docs.
  • Debugging:
    • Typed RPC client provides structured error responses (e.g., JsonRpcException).
    • Parity tests against ethers.js help validate correctness.
  • Community:
    • No active community → rely on GitHub issues or maintainer responses.
    • Consider opening feature requests early (e.g., batch transactions, EIP-4844).

Scaling

  • Performance:
    • Offline signing is CPU-bound (secp256k1 operations). Benchmark for high-throughput apps.
    • RPC client is async-friendly (PSR-18 allows concurrent requests).
  • Horizontal Scaling:
    • Stateless: The SDK itself doesn’t scale; RPC rate limits may require queueing or load balancing across multiple nodes.
    • Database: Store transaction hashes/nonces to avoid duplicates.
  • Cost:
    • No external API costs (unlike Infura/Alchemy) for offline operations.
    • RPC node costs (e.g., Alchemy, QuickNode) still apply for online interactions.

Failure Modes

Risk Impact Mitigation
PHP Extension Missing (gmp, `
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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity