Download the PHP package ournameismud/currency-layer without Composer

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

Currency Layer plugin for Craft CMS 3.x

API integration with https://currencylayer.com/

Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

    cd /path/to/project
  2. Then tell Composer to load the plugin:

    composer require ournameismud/currency-layer
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Currency Layer.

Currency Layer Overview

This is a plugin layer for the Currency Layer API that lets you store and retrieve currency values locally. If you use this in conjunction with Craft Commerce it will populate the conversion rate values for corresponding Payment Currencies.

Configuring Currency Layer

To use this plugin you will require an API key from Currency Layer. A basic account is free but rate-limited to 250 Requests/mo.

Options available in the plugin can be saved in Plugin > Settings or via a config file.

The plugin settings available are:

Using Currency Layer

You can use Currency Layer in one of two ways. The first way is via an action. This is best used in conjunction with a CRON job to fetch the results periodically. The action can be triggered via a URL as follows:

http://your.domain.com/actions/currency-layer/currency/fetch?currencies=EUR,GBP,USD with the currencies parameter being a comma-separated list of currencies you wish to retrieve. Note that the base (free) version of Currency Layer will always default to USD as the source.

If you are using Craft Commerce this action will save the conversion rates directly into your Commerce settings. Otherwise the conversion values are available via the craft.currencyLayer.fetch() variable:

craft.currencyLayer.fetch(request,type) where request is required and should be an object of key:value attributes corresponding to the endpoints for the Currency Layer API you require (please note that many of the endpoints are limited to paid-for accounts). The type parameter corresponds to the type of query you wish to make (defaults to live).

For example, {% set data = craft.currencyLayer.fetch({ currencies:'EUR,GBP,USD' }) %} would fetch the following endpoint: https://apilayer.net/api/live?currencies=EUR,GBP,USD&access_key=YOUR_ACCESS_KEY. The response will be an array of values which provide multipliers based on the primary currency defined in your plugin settings. With this in mind we can build out a macro to perform some simple currency conversion, for example:

{%- macro convert(value = 1, currency) -%}
    {% set data = craft.currencyLayer.fetch({ currencies:'EUR,GBP,USD' }) %}
    {{- data[currency] * value -}}
{%- endmacro -%}

{% set GBP = 100 %}
{% set EUR = _self.convert(100,'EUR') %}
{% set USD = _self.convert(100,'USD') %}

<dl>
    <dt>GBP</dt><dd>{{ GBP }}</dd>
    <dt>EUR</dt><dd>{{ EUR }}</dd>
    <dt>USD</dt><dd>{{ USD }}</dd>
</dl>

The plugin is designed to work closely with Craft Commerce currencies. If currencies are already defined in Craft Commerce the option to select a primary currency is restricted to those available in Craft Commerce. If a new primary currency is selected in the plugin then the primary Craft Commerce currency is updated and vice versa.

Currency Layer Roadmap

Some things to do, and ideas for potential features:

Brought to you by cole007


All versions of currency-layer with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^3.0.0-RC1
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 ournameismud/currency-layer contains the following files

Loading the files please wait ....