Download the PHP package ophelios/php-ethereum-moralis without Composer
On this page you can find all versions of the php package ophelios/php-ethereum-moralis. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ophelios/php-ethereum-moralis
More information about ophelios/php-ethereum-moralis
Files in ophelios/php-ethereum-moralis
Package php-ethereum-moralis
Short Description Simple token price fetching from Moralis.io for PHP.
License MIT
Informations about the package php-ethereum-moralis
PHP Ethereum Moralis
A tiny PHP library to fetch ERC‑20 token information (including price) from Moralis.io. Simple facade, PSR‑16 caching support, and a typed result object.
✨ Features
- Fetch current token information (including price) by contract address
- Optional caching via PSR‑16 (e.g., APCu, files, Redis)
- Typed result: Moralis\MoralisToken with all common fields
💿 Installation
Install with Composer:
Requirements: PHP >= 8.4
🌱 Quick start
Specify a different chain:
📦 Result type: MoralisToken
The library maps Moralis API JSON into a typed object:
- tokenName, tokenSymbol, tokenLogo, tokenDecimals
- nativePrice: object|null (value, decimals, name, symbol, address)
- usdPrice, usdPriceFormatted
- exchangeName, exchangeAddress
- tokenAddress
- priceLastChangedAtBlock, blockTimestamp
- possibleSpam, verifiedContract
- pairAddress, pairTotalLiquidityUsd
- securityScore
- usdPrice24hr, usdPrice24hrUsdChange, usdPrice24hrPercentChange
- percentChange24hr
🧰 Using a cache (PSR‑16)
You can attach any PSR‑16 cache. For convenience, ophelios/php-apcu-cache provides an APCu implementation.
Default cache TTL is 300 seconds.
⚙️ Custom client/configuration
If you need to control base URL or timeouts, you can pass your own MoralisClient.
🧪 Testing
This repo includes unit tests and an optional live integration test.
Run all tests:
Run unit tests only:
Integration test requires a Moralis API key. You can place it in an .env file:
Then run:
🤝 Contributing
- Open an issue for bugs or feature ideas
- Submit a PR with a clear description and tests when applicable
📄 License
MIT License © 2025 Ophelios. See LICENSE for details.