2017 © Pedro Peláez
 

cakephp-plugin currency-exchange

A CakePHP 2 helper for displaying prices in various currencies

image

davidyell/currency-exchange

A CakePHP 2 helper for displaying prices in various currencies

  • Monday, January 22, 2018
  • by davidyell
  • Repository
  • 2 Watchers
  • 4 Stars
  • 46 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Currency Exchange

A helper for CakePHP 2.x which will display a currency in a different currency using current exchange rates., (*1)

It will cache the result for a year and then check the response from the api before invalidating the cache to ensure that your site always serves some currency data, even if it's a little stale. This prevents your page having to wait for a response from the api whilst it's loading., (*2)

Requirements

  • CakePHP 2.4+

Installation

There are two main installation methods depending on your setup. However, whichever one you chose you must include the bootstrap when loading the plugin, in order to load the cache configuration., (*3)

CakePlugin::load('CurrencyExchange', ['bootstrap' => true]);

Make sure to include your CurrencyLayer API key in your config/bootstrap.php using Configure::write('currencyLayer.apikey', "YourApiKeyGoesHere");, (*4)

Manual plugin installation

Download the zip and unzip it to the app/Plugin/CurrencyExchange folder., (*5)

Using Composer

You can require it with composer require "davidyell/currency_exchange:dev-master", (*6)

Helper

The helper is provided to do the front-end conversion when displaying prices in different currencies. The helper takes a number of options to configure it's behaviour., (*7)

Helper configuration

When you are adding the helper to your $helpers array in your controller, you can pass an array of options. The defaults are shown below as an example. If you're happy with the defaults you don't need to pass any configuration., (*8)

// app/Controller/AppController.php
    public $helpers = [
        'CurrencyExchange.Currency'
    ];

// Examples/index.ctp
echo $this->Currency->display($price, 'GBP');

Shell

A shell is provided to allow updating of the cached exchange rate data via a cron job. This prevents the request having to wait to see if the remote api is available before returning data to the user., (*9)

Instead you can set the shell to run on a cron as often as you need and it will update the data in the background, keeping your front-end quick for your users and your data fresh. Only if a valid response is recieved from the api will the cache be updated., (*10)

Updating the cache

The frequency at which the cache is updated is controlled by how often you chose to run the shell task. I'd recommend setting a cron job which runs once a week to update the cache., (*11)

The Versions

22/01 2018

dev-master

9999999-dev https://bitbucket.org/ukwm/campaigns-plugins-currencyexchange/overview

A CakePHP 2 helper for displaying prices in various currencies

  Sources   Download

The Requires

 

cakephp currency exchange exchange rates prices

22/01 2018

0.0.4

0.0.4.0 https://bitbucket.org/ukwm/campaigns-plugins-currencyexchange/overview

A CakePHP 2 helper for displaying prices in various currencies

  Sources   Download

The Requires

 

cakephp currency exchange exchange rates prices

21/09 2016

3.x-dev

3.9999999.9999999.9999999-dev https://bitbucket.org/ukwm/campaigns-plugins-currencyexchange/overview

A CakePHP 3 helper for displaying prices in various currencies

  Sources   Download

The Requires

 

The Development Requires

currency cakephp3 exchange exchange rates prices

18/08 2015

0.0.3

0.0.3.0 https://bitbucket.org/ukwm/campaigns-plugins-currencyexchange/overview

A CakePHP 2 helper for displaying prices in various currencies

  Sources   Download

The Requires

 

cakephp currency exchange exchange rates prices

18/08 2015

0.0.2

0.0.2.0 https://bitbucket.org/ukwm/campaigns-plugins-currencyexchange/overview

A CakePHP 2 helper for displaying prices in various currencies

  Sources   Download

The Requires

 

cakephp currency exchange exchange rates prices