Download the PHP package planetbiru/forex without Composer

On this page you can find all versions of the php package planetbiru/forex. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package forex

Forex

Foreign Exchange

A PHP library to fetch and parse currency exchange rates from the European Central Bank (ECB). This library provides methods to convert currencies based on the retrieved exchange rates.

Important Performance Note

Fetching historical data (especially via loadHistory or loadByDate) involves processing large XML datasets. This operation should only be performed by back-end processes (e.g., cron jobs, background workers) and must not be triggered synchronously by front-end user actions. To ensure optimal performance, always prefer fetching the minimal dataset required (e.g., loadDaily or loadLast90Days) over the full history.

Table of Contents


Installation

Install the library using Composer:


Initialization

Ensure that the class file is included or that an autoloader is being used.


Loading Data

loadDaily

Loads the latest daily reference exchange rates.

Example 1: Basic usage

Example 2: Reload daily data

Example 3: Check currency availability after loading


loadLast90Days

Loads exchange rate references from the last 90 days file (using the most recent date available in that file).

Example 1: Basic usage

Example 2: Using class constants

Example 3: Validation after loading


loadHistory

Loads exchange rate references from the full historical file (since 1999). By default, it retrieves the most recent available date.

Example 1: Basic usage

Example 2: Preparation for loadByDate

Example 3: Handling large files


loadByDate

Loads exchange rates for a specific date (YYYY-MM-DD) from the full historical dataset.

Example 1: Load a valid date

Example 2: Handle a date that is not found

Example 3: Searching dates in a loop


load

Loads data from a custom XML URL.

Example 1: Load from a custom URL

Example 2: Load from a local file

Example 3: Reload with a different source


Data Access & Manipulation

get

Retrieves the exchange rate for a specific currency.

Example 1: Get USD rate

Example 2: Get IDR (Indonesian Rupiah) rate

Example 3: Case insensitive


set

Manually sets an exchange rate.

Example 1: Override an existing rate

Example 2: Add a new currency

Example 3: Update IDR rate


convert

Converts an amount from one currency to another.

Example 1: Convert USD to IDR

Example 2: Convert EUR to GBP

Example 3: Convert JPY to USD


getAllRates

Returns all available exchange rates as an array.

Example 1: Dump all data

Example 2: Count available currencies

Example 3: Loop through all rates


getDate

Retrieves the date of the currently loaded exchange rate data.

Example 1: Display the date

Example 2: Format the date

Example 3: Date validation


All versions of forex with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package planetbiru/forex contains the following files

Loading the files please wait ...