Download the PHP package orkhanahmadov/currencylayer without Composer

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

:currency_exchange: PHP client for currencylayer.com

Latest Stable Version Latest Unstable Version Total Downloads License

Build Status Test Coverage Maintainability Quality Score StyleCI

Simple PHP client for currencylayer.com currency rates.

Installation

You can install the package via composer:

Usage

Instantiate Orkhanahmadov\Currencylayer\CurrencylayerClient class and pass your "access key"

You can find your access key in Currencylayer Dashboard.

If you are using paid plan, you can use HTTPS connection to currencylayer.com API. While instantiating pass true as second parameter to use HTTPS connection.

Available methods

quotes()

Use this method to fetch live and historical currency rates.

Pass source currency to source() method and rate currency currency() method. Following example will fetch live rates from USD to EUR.

You can also pass multiple rate currencies to currency() method:

If you want fetch rates for specific date, you can pass the date to date() method. date() method accepts dates as string or instance of DateTimeInterface.

quotes() method returns instance of Orkhanahmadov\Currencylayer\Data\Quotes. This class has following methods that you can use:

You can also get rates for each fetched currency using currency name as property:

convert()

Use this method to convert amount in one currency to another currency.

Pass source currency to source() method, rate currency currency() method and amount to convert() method. Following example will convert 10 USD to GBP using live rates.

If you want conversion based on different date's rates, you can pass the date to date() method. date() method accepts dates as string or instance of DateTimeInterface.

convert() method returns instance of Orkhanahmadov\Currencylayer\Data\Conversion. This class has following methods that you can use:

timeframe()

Use this method to show rates between given dates.

Pass source currency to source() method, rate currencies to currency() method and start date as first argument and end date as second argument to timeframe() method. Start and end dates can be string of dates or instances of DateTimeInterface.

Following example will return timeframe rates from USD to GBP and EUR between 2010-03-01 and 2010-04-01.

timeframe() method returns instance of Orkhanahmadov\Currencylayer\Data\Timeframe. This class has following methods that you can use:

You can also use currency code as function call and pass date to get rates:

change()

Use this method to show currency rate change between given dates.

Pass source currency to source() method, rate currencies to currency() method and start date as first argument and end date as second argument to change() method. Start and end dates can be string of dates or instances of DateTimeInterface.

Following example will return rate change from USD to GBP and EUR between 2010-03-01 and 2010-04-01.

change() method returns instance of Orkhanahmadov\Currencylayer\Data\Change. This class has following methods that you can use:

list()

Use this method to get list of all available currencies.

Method will return array of currencies in currencyCode => currencyName structure.

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of currencylayer with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
ext-json Version *
guzzlehttp/guzzle Version ^6.3
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 orkhanahmadov/currencylayer contains the following files

Loading the files please wait ....