Download the PHP package ophelios/php-ethereum-ens without Composer
On this page you can find all versions of the php package ophelios/php-ethereum-ens. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-ethereum-ens
PHP Ethereum ENS 🚀
A lightweight PHP library for reading ENS (Ethereum Name Service) records using any standard JSON‑RPC provider. Read‑only by design, fast to adopt, and easy to extend.
✨ Features
- 🔄 Reverse lookup (address → primary ENS name)
- 🧩 Resolve text records and avatar for a name
- 👤 Simple profile hydrator for common records
- 🎛️ Tiny facade (EnsService) for convenience
- 🔒 Read‑only eth_call usage (no private keys needed)
- ⚡ Works with any Ethereum‑compatible RPC endpoint
💿 Installation
Install with Composer:
🌱 Quick start
🎯 Resolve individual records
📚 API overview
-
Ens\EnsService
- __construct(string|Ens\Web3ClientInterface $clientOrRpcUrl)
- resolveEnsName(string $address): ?string
- resolveProfile(string $ensName, array $records = Ens\ProfileHydrator::DEFAULT_RECORDS): Ens\EnsProfile
- resolveAvatar(string $ensName, bool $parentFallback = true): ?string
- resolveRecord(string $ensName, string|array $record): ?string
- resolveRecords(string $ensName, array $records): ?array
- Ens\Resolver: resolve individual records for a name. Handles inherited resolvers and one‑level parent fallback for avatar.
- Ens\ReverseLookup: reverse resolve address → name using registry, with default reverse resolver fallback.
- Ens\ProfileHydrator: populate an EnsProfile with a set of requested records.
- Ens\Utilities: normalize(string $name), namehash(string $name)
- Ens\Web3ClientInterface / Ens\Web3Client: thin wrapper around web3p/web3.php for eth_call with retries.
⚙️ Configuration (custom client)
You can pass a custom client instead of a URL if you need to control retries or timeouts:
🧰 Default records
ProfileHydrator::DEFAULT_RECORDS includes:
- avatar, url, email, description
- social aliases: ["com.twitter", "twitter"], ["com.github", "github"]
When an array of keys is provided, the first matching key is mapped to the corresponding profile property; all keys in that group are still available in $profile->texts.
🧪 Testing
The test suite contains both unit tests (with mocks) and an optional live integration test.
Run all tests (unit + integration):
Run unit tests only:
Integration tests require an Ethereum RPC URL with ENS access. Set an environment variable:
Then run:
🤝 Contributing
We welcome contributions! If you find a bug or have an enhancement in mind:
- Open an issue to discuss it, or
- Send a pull request (PR) with a clear description and relevant tests.
To work on the project locally:
- Install dependencies:
composer install - Run unit tests:
vendor/bin/phpunit --testsuite Unit - Please do not modify integration tests in PRs unless specifically discussed.
📄 License
MIT License © 2025 Ophelios. See the LICENSE file for full text.
🗒️ Notes
- Read‑only on‑chain calls via eth_call. No private keys are required.
- For internationalized domains,
normalize()attempts to useidn_to_asciiwhen available. - Mainnet registry and default reverse resolver addresses are embedded in the library.