allratestoday / sdk
Official PHP SDK for AllRatesToday exchange rate API
Package info
github.com/AllRates-Today/exchange-rates-api
Language:TypeScript
pkg:composer/allratestoday/sdk
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
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.