allratestoday/sdk
Composer 安装命令:
composer require allratestoday/sdk
包简介
Official PHP SDK for AllRatesToday exchange rate API
README 文档
README
AllRatesToday is a free, fast, and reliable REST API for real-time and historical currency exchange rates. Sourced from Reuters (Refinitiv) and interbank market feeds.
- Website: allratestoday.com
- Free API key: allratestoday.com/register
- Docs: allratestoday.com/docs
🚀 Features
- ⚡ Real-time rates — Live mid-market exchange rates updated on every request
- 🌍 160+ currencies — Major, emerging market, and popular currencies
- 📅 Historical data — Access historical rates with flexible date ranges (1d/7d/30d/1y)
- 📦 Official SDKs — JavaScript/TypeScript, Python, PHP, and React
- 🆓 Free tier — Get started at no cost
- 🛡️ Fast & reliable — Powered by Cloudflare's global edge network
- 📡 Data source — Reuters (Refinitiv) and interbank market feeds
📦 Official SDKs
JavaScript / TypeScript
npm install @allratestoday/sdk
import AllRatesToday from '@allratestoday/sdk'; const client = new AllRatesToday(); const rate = await client.getRate('USD', 'EUR'); console.log(`1 USD = ${rate.rate} EUR`); // Convert amount const result = await client.convert('USD', 'EUR', 100); console.log(`$100 = €${result.result}`); // With API key for higher limits & historical data const auth = new AllRatesToday({ apiKey: 'art_live_...' }); const history = await auth.getHistoricalRates('USD', 'EUR', '30d');
Python
pip install allratestoday
from allratestoday import AllRatesToday client = AllRatesToday() rate = client.get_rate("USD", "EUR") print(f"1 USD = {rate['rate']} EUR") # Convert amount result = client.convert("USD", "EUR", 100) print(f"$100 = €{result['result']}") # With API key for higher limits & historical data auth = AllRatesToday(api_key="art_live_...") history = auth.get_historical_rates("USD", "EUR", "30d")
PHP
composer require allratestoday/sdk
use AllRatesToday\AllRatesToday; $client = new AllRatesToday(); $rate = $client->getRate('USD', 'EUR'); echo "1 USD = {$rate['rate']} EUR"; // Convert amount $result = $client->convert('USD', 'EUR', 100); echo "$100 = €{$result['result']}"; // With API key for higher limits & historical data $auth = new AllRatesToday('art_live_...'); $history = $auth->getHistoricalRates('USD', 'EUR', '30d');
React
npm install react-currency-localizer-realtime
import { LocalizedPrice } from 'react-currency-localizer-realtime'; // Automatically detects user's currency via IP geolocation function PricingCard() { return ( <div> <h3>Pro Plan</h3> <LocalizedPrice basePrice={19.99} baseCurrency="USD" apiKey="art_live_..." /> </div> ); }
import { useCurrencyConverter } from 'react-currency-localizer-realtime'; // Hook-based API for full control function ProductPrice({ price }: { price: number }) { const { convertedPrice, localCurrency, isLoading } = useCurrencyConverter({ basePrice: price, baseCurrency: 'USD', apiKey: 'art_live_...', }); if (isLoading) return <span>Loading...</span>; return ( <span> {new Intl.NumberFormat(undefined, { style: 'currency', currency: localCurrency || 'USD', }).format(convertedPrice || price)} </span> ); }
import { useCurrencyLocalizer } from 'react-currency-localizer-realtime'; // Batch conversion for product lists function ProductList({ products }) { const { convertAndFormat, isReady } = useCurrencyLocalizer({ baseCurrency: 'USD', apiKey: 'art_live_...', }); return ( <ul> {products.map(p => ( <li key={p.id}>{p.name}: {isReady ? convertAndFormat(p.price) : '...'}</li> ))} </ul> ); }
🏁 Quick Start (No SDK)
curl "https://allratestoday.com/api/v1/rates?source=USD&target=EUR" \ -H "Authorization: Bearer YOUR_API_KEY"
Get your free API key at allratestoday.com/register.
📚 API Endpoints
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/v1/rates |
Yes | Exchange rates (supports comma-separated targets) |
| GET | /api/v1/symbols |
No | List all supported currencies |
| GET | /api/rate |
Yes | Simple pair rate lookup |
| GET | /api/historical-rates |
Yes | Historical rate data & time series |
🌍 Supported Currencies
160+ currencies including:
Major: USD, EUR, GBP, JPY, CHF, CAD, AUD, NZD
Popular: INR, CNY, BRL, MXN, TRY, ZAR, SGD, HKD, KRW, THB, PHP, PKR, BDT, LKR, NGN, GHS, KES, AED, SAR, EGP, and more
🛡️ Error Handling
| Code | Description |
|---|---|
| 400 | Bad request — missing or invalid parameters |
| 401 | Missing or invalid API key |
| 429 | Rate limit or monthly quota exceeded |
| 500 | Internal server error |
| 503 | Service temporarily unavailable |
📄 API Specifications
For the complete technical reference, download the AllRatesToday Currency Data API Specifications document:
- Download PDF — Full 20-page API specification (endpoints, parameters, responses, error codes, SDKs)
- View Online — Browse the specification on our website
🔗 Links
- Website: allratestoday.com
- API Specs: allratestoday.com/api-specifications
- API Docs: allratestoday.com/docs
- Developer Guide: allratestoday.com/developers
- Status: allratestoday.com/status
- Support: allratestoday.com/contact
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
allratestoday/sdk 适用场景与选型建议
allratestoday/sdk 是一款 基于 TypeScript 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 4, 最近一次更新时间为 2026 年 04 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「currency」 「forex」 「exchange-rate」 「Reuters」 「allratestoday」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 allratestoday/sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 allratestoday/sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 allratestoday/sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A client for Barchart OnDemand market data.
A PSR-7 compatible library for making CRUD API endpoints
Fixer.io data provider for Peso
TCMB Currenct Converter
Immutable PHP currency converter that's data-agnostic.
Foreign exchange rates API Against The Naira
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-09