Docs
PHP Currency Exchange Rate API Documentation

PHP Currency Exchange Rate API Documentation

Comprehensive guide on using our PHP Currency Exchange Rate API for efficient currency conversion and integration.

Introduction to Our PHP Currency Exchange Rate API

Our Currency Exchange Rate API is designed to provide accurate and reliable exchange rates for PHP developers. Whether for personal projects or professional applications, our API offers an easy integration process with minimal dependencies.

Why Choose Our PHP Currency Exchange Rate API?

Integrating our API into your PHP project is straightforward with simple GET requests. This seamless integration ensures that you can start using our API without any complex setup.

Our API delivers JSON responses that are quick to parse and easy to read. PHP’s efficient native libraries for handling JSON ensure smooth access to exchange rate data with minimal effort.

For detailed information on supported requests and features, refer to our Main Documentation.

Quick Start: PHP Currency Conversion Example

To begin using our API, you need to sign up for a free account to obtain your API key. Register here to get your key.

Here’s a basic example of how to use our API with PHP:

// Fetching JSON
$req_url = 'https://api.currencyexchangerate-api.com/v1/YOUR-API-KEY/latest/USD';
$response_json = file_get_contents($req_url);
 
// Continuing if we got a result
if(false !== $response_json) {
 
    // Try/catch for json_decode operation
    try {
 
		// Decoding
		$response = json_decode($response_json);
 
		// Check for success
		if('success' === $response->result) {
 
			// YOUR APPLICATION CODE HERE, e.g.
			$base_price = 12; // Your price in USD
			$EUR_price = round(($base_price * $response->conversion_rates->EUR), 2);
 
		}
 
    }
    catch(Exception $e) {
        // Handle JSON parse error...
    }
 
}
 

Sample JSON Response

Here’s a sample JSON response from the API with USD as the base currency code:

{
  "result": "success",
  "base_code": "USD",
  "qouta": 100,
  "remining": 78,
  "conversion_rates": {
    "USD": 1,
    "AED": 3.6725,
    "AFN": 71.3023,
    ...
  }
}

For additional details on request types, error handling, and more, please visit our Main Documentation.

Need Help?

If you have any questions or need further assistance, don’t hesitate to contact us. We’re here to assist you!