Search by

Official PHP SDK for AllRatesToday exchange rate API

Package info

github.com/AllRates-Today/exchange-rates-api

Homepage

Language:TypeScript

pkg:composer/allratestoday/sdk

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 6

Open Issues: 2

v1.3.1 2026-04-09 20:01 UTC

This package is auto-updated.

Last update: 2026-11-02 18:22:24 UTC


README

Powered by AllRatesToday

AllRatesToday is a free, fast, and reliable REST API for real-time and historical currency exchange rates. Mid-market rates with no retail spread.

API Status Tests codecov Known Vulnerabilities zero dependencies License TypeScript npm PyPI Packagist

๐Ÿš€ 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) on paid plans
  • ๐Ÿ“ฆ Official SDKs โ€” JavaScript/TypeScript, Python, PHP, and React
  • ๐Ÿ†“ Free tier โ€” Get started at no cost (latest rates; history is on paid plans)
  • ๐Ÿ›ก๏ธ Fast & reliable โ€” Powered by Cloudflare's global edge network
  • ๐Ÿ’น Mid-market rates โ€” no retail spread baked in

๐Ÿ“ฆ Official SDKs

JavaScript / TypeScript

npm install @allratestoday/sdk
import AllRatesToday from '@allratestoday/sdk';

// An API key is required (free at https://allratestoday.com/register)
const client = new AllRatesToday({ apiKey: 'art_live_...' });
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}`);

// Historical data (paid plans; free and trial keys get 403 historical_requires_paid_plan)
const history = await client.getHistoricalRates('USD', 'EUR', '30d');

Python

pip install allratestoday
from allratestoday import AllRatesToday

# An API key is required (free at https://allratestoday.com/register)
client = AllRatesToday(api_key="art_live_...")
rate = client.get_rate("USD", "EUR")  # returns a list of rate objects
print(f"1 USD = {rate[0]['rate']} EUR")

# Convert amount
result = client.convert("USD", "EUR", 100)
print(f"$100 = โ‚ฌ{result['result']}")

# Historical data (paid plans; free and trial keys get 403 historical_requires_paid_plan):
# {"source", "target", "data": [{"date", "rate", "timestamp"}, ...]}
history = client.get_historical_rates("USD", "EUR", "30d")

PHP

composer require allratestoday/sdk
use AllRatesToday\AllRatesToday;

// An API key is required (free at https://allratestoday.com/register)
$client = new AllRatesToday('art_live_...');
$rate = $client->getRate('USD', 'EUR'); // returns a list of rate objects
echo "1 USD = {$rate[0]['rate']} EUR";

// Convert amount
$result = $client->convert('USD', 'EUR', 100);
echo "$100 = โ‚ฌ{$result['result']}";

// Historical data (paid plans; free and trial keys get 403 historical_requires_paid_plan)
$history = $client->getHistoricalRates('USD', 'EUR', '30d');

React

npm install react-currency-localizer-realtime
import { LocalizedPrice } from 'react-currency-localizer-realtime';

// Automatically detects the visitor's currency. No API key needed:
// keyless mode uses free daily ECB rates (~30 currencies) and renders a
// "Rates by AllRatesToday" link. Pass apiKey for real-time + 160 currencies.
function PricingCard() {
  return (
    <div>
      <h3>Pro Plan</h3>
      <LocalizedPrice basePrice={19.99} baseCurrency="USD" />
    </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; time / from/to history needs a paid plan)
GET /api/v1/symbols No List all supported currencies
GET /api/rate Yes Simple pair rate lookup
GET /api/historical-rates Paid plan 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 32-page API specification (endpoints, parameters, responses, error codes, SDKs)
  • View Online โ€” Browse the specification on our website

๐Ÿ”— Links

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.