Download the PHP package infiniweb/fixer-api-php without Composer

On this page you can find all versions of the php package infiniweb/fixer-api-php. 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 fixer-api-php

PHP wrapper for Fixer API

This API wrapper provides a simple way to access fixer.io API in order to easily consume the endpoints with a PHP application.


We are supporting multiple endpoints:


Installation

You can use composer to include this package to your project:

composer require infiniweb/fixer-api-php

Quick Start

You will need first to instanciate the Fixer class:

$fixer = new \InfiniWeb\FixerAPI\Fixer();

And provide the Fixer API Key:

$fixer->setAccessKey($apiKey);

Make sure to first get your Free or paid API Key here https://fixer.io/product

You are now ready to consume the API!

Symbols

To get the list of Symbols, simply use the following:

$symbols = $fixer->symbols->get();

This will return a list of symbols (ISO 4217 Currency Code) as a simple array:

Array
(
    [AED] => United Arab Emirates Dirham
    [AFN] => Afghan Afghani
    [ALL] => Albanian Lek
    ...

Rates

The are various ways to get rates. It can be real-time data, historical data or series data (from a date to another date)

Real-time rates

You can get the latest rates for all or for specific currencies:

$baseCurrency = "EUR";
$symbols = array("USD", "GBP");
$return = $fixer->rates->get($baseCurrency, $symbols);

This will return the rates of provided currencies compared to the base currency.

Array
(
    [timestamp] => 1528014248
    [base] => EUR
    [rates] => Array
        (
            [USD] => 1.166583
            [GBP] => 0.874168
        )
)

Historical rates

You could also retrive historical rate data by including the date in the request, such as:

$fixer->rates->get($baseCurrency, $symbols, "2018-01-19");

Note that the date needs to be following this format: YYYY-MM-DD

Time-series rates

You can get daily rates from a starting end an end date, using:

$return = $fixer->rates->getDailyRates("2018-05-01", "2018-05-03", $baseCurrency, $symbols);

Array
(
    [base] => EUR
    [rates] => Array
        (
            [2018-05-01] => stdClass Object
                (
                    [USD] => 1.199468
                    [GBP] => 0.881297
                )
            [2018-05-02] => stdClass Object
                (
                    [USD] => 1.195602
                    [GBP] => 0.880967
                )
            ...

Fluctuations

The parameters to retrieve the fluctuations are exactly the same then the time-series rates.

$return = $fixer->rates->getDailyFluctuation("2018-05-01", "2018-05-03", $baseCurrency, $symbols);

You will then get the daily flactuations for each currencies from the start to end date:

Array
(
    [base] => EUR
    [rates] => Array
        (
            [USD] => stdClass Object
                (
                    [start_rate] => 1.199468
                    [end_rate] => 1.199326
                    [change] => -0.0001
                    [change_pct] => -0.0118
                )
            [GBP] => stdClass Object
                (
                    [start_rate] => 0.881297
                    [end_rate] => 0.883748
                    [change] => 0.0025
                    [change_pct] => 0.2781
                )
        )
)

Convert

You can request the conversion from a currency to another. If you provide a date, it will return an historical rate.

$from = "EUR";
$to = "USD";
$amount = "25";
$date = "2018-01-19";
$return = $fixer->convert->get($from, $to, $amount, $date);

You will receive the following array:

Array
(
    [timestamp] => 1516406399
    [rate] => 1.222637
    [result] => 30.565925
)

Additional features

SSL support

All paid subscription plans available on Fixer.io come with 256-bit SSL encryption. You can enable SSL support by providing extra information in the class constructor:

$config = array('ssl' => true);
$fixer = new \InfiniWeb\FixerAPI\Fixer($config);

All versions of fixer-api-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
php-curl-class/php-curl-class Version dev-master
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 infiniweb/fixer-api-php contains the following files

Loading the files please wait ....