PHPackages                             alessandrominoccheri/codeigniter-currency-converter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. alessandrominoccheri/codeigniter-currency-converter

ActivePlugin[Utility &amp; Helpers](/categories/utility)

alessandrominoccheri/codeigniter-currency-converter
===================================================

A Codeigniter library to convert your price from a currency to another

v2.0.1(7y ago)2316519[1 issues](https://github.com/AlessandroMinoccheri/codeigniter-currency-converter/issues)MITPHPPHP &gt;=5.3.0

Since Feb 1Pushed 7y ago4 watchersCompare

[ Source](https://github.com/AlessandroMinoccheri/codeigniter-currency-converter)[ Packagist](https://packagist.org/packages/alessandrominoccheri/codeigniter-currency-converter)[ Docs](https://github.com/AlessandroMinoccheri/codeigniter-currency-converter)[ RSS](/packages/alessandrominoccheri-codeigniter-currency-converter/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (8)Dependencies (2)Versions (14)Used By (0)

codeigniter-currency-converter V 1.3.2
======================================

[](#codeigniter-currency-converter-v-132)

[![Code Quality](https://camo.githubusercontent.com/d1cbe5df0e8edef0e3040d1d9f4eec0c611e3f9d23cd2d43563ce56b2ed87e21/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c657373616e64726f6d696e6f6363686572692f636f646569676e697465722d63757272656e63792d636f6e7665727465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/alessandrominoccheri/codeigniter-currency-converter/badges/quality-score.png?b=master)[![Code Coverage](https://camo.githubusercontent.com/cef73d0c84863d2867fc6f45f39897055b62021f85821b1e2df1b2d48f61c0c9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c657373616e64726f6d696e6f6363686572692f636f646569676e697465722d63757272656e63792d636f6e7665727465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/alessandrominoccheri/codeigniter-currency-converter/badges/coverage.png?b=master)[![Latest Stable Version](https://camo.githubusercontent.com/4e0d68a59d4d00121d4a3cd55195291480bb4e05b4e5ca62bc2b3d7d7392d9e6/68747470733a2f2f706f7365722e707567782e6f72672f616c657373616e64726f6d696e6f6363686572692f636f646569676e697465722d63757272656e63792d636f6e7665727465722f762f737461626c652e737667)](https://packagist.org/packages/alessandrominoccheri/codeigniter-currency-converter)[![License](https://camo.githubusercontent.com/e9d55511d0bd7fb34e5b31aa049a8d11234e6c98e52a26bf90ab2389354b2837/68747470733a2f2f706f7365722e707567782e6f72672f616c657373616e64726f6d696e6f6363686572692f636f646569676e697465722d63757272656e63792d636f6e7665727465722f6c6963656e73652e737667)](https://packagist.org/packages/alessandrominoccheri/codeigniter-currency-converter)[![Build Status](https://camo.githubusercontent.com/5262ede17f0799df37fed61ea76d1b460d354b72b8ae92e522c372a661b6a4c7/68747470733a2f2f6170692e7472617669732d63692e6f72672f416c657373616e64726f4d696e6f6363686572692f636f646569676e697465722d63757272656e63792d636f6e7665727465722e706e67)](https://travis-ci.org/AlessandroMinoccheri/codeigniter-currency-converter)[![Total Downloads](https://camo.githubusercontent.com/0d3eded1fcf6b3adb39c662e4813741084aa8fbe84434d5634b65530cfa37d71/68747470733a2f2f706f7365722e707567782e6f72672f616c657373616e64726f6d696e6f6363686572692f636f646569676e697465722d63757272656e63792d636f6e7665727465722f642f746f74616c2e706e67)](https://packagist.org/packages/alessandrominoccheri/codeigniter-currency-converter)

A Codeigniter library to convert your price from a currency to another

---

Background
----------

[](#background)

Is very frequently that inside your sites you need to convert your price from a currency to another. This library convert your price in every currency of the world.

It works with fixer.io api and store currency rates inside the site database if you want. User can configure in hour the time of currency rates update, if the user doesn't want to use database, rates are updated every time with the current conversion.

If you have set to use database, for example, user sets to update currency rates every hour, this library get the currency conversion from fixer.io the first time, store it inside the database and for the next hour it takes conversion rates from the database if exist. In this way reduce the request time to convert and every hour currency rates are updated.

If you haven't set to use database, instead, every time you call the library it makes a request to fixer.io api and gets the actual conversion rate. This solution is great if you have not a lot of request. Instead, if you have a lot of conversion request is better to use the database configuration.

---

Requirements
------------

[](#requirements)

- CodeIgniter 2.x or 3.x
- PHP 5.3 or gretaer

---

Installation
============

[](#installation)

With composer you can install this package:

```
composer require alessandrominoccheri/codeigniter-currency-converter

```

Or Drag and drop the application/libraries/CurrencyConverter.php file into your application directories. Load it from your application/config/autoload.php using:

```
$autoload['libraries'] = array('database', 'CurrencyConverter');

```

Or inside your model you can use:

```
$this->CurrencyConverter = new CurrencyConverter();

```

It's important to have a valid database connection because the library saves conversion inside it if you want to use it.

---

Usage
=====

[](#usage)

To convert your price you can make a request like this from your model / controller:

```
$result = $this->CurrencyConverter->convert('GBP', 'EUR', '2000.00', true, 1);

```

To get a list of currency code you can check here:

[List of available currency code](http://www.xe.com/iso4217.php)

---

Params
======

[](#params)

The function declaration to retrieve your converted price is:

```
function convert($from_Currency, $to_Currency, $amount, $save_into_db = 1, $hour_difference = 1)

```

- fromCurrency: is the actual price currency (Example: EUR, GBP)
- toCurrency: is the currency that you want to convert your price (Example: EUR, GBP)
- amount: is the price to convert (Example: 200, 20)
- saveIntoDb: is the variable that configure to use the database or not, if not hour\_difference params is escaped
- hourDifference: is the hour difference to update your currency conversion. For example if you have set to update currency rates every hour, this library get the currency conversion from fixer.io the first time, store it inside the database and for the next hour it takes conversion rates from the database if exist.

---

Api KEY
=======

[](#api-key)

To use this library you need to add your api key inside the configuration. to get your api key go to this site and generate it.

[Generate your api key](https://www.currencyconverterapi.com/)

---

License
-------

[](#license)

The MIT License (MIT)

Copyright (c) 2014 Alessandro Minoccheri

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~148 days

Recently: every ~118 days

Total

11

Last Release

2681d ago

Major Versions

v1.4.0 → v2.0.02019-02-26

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3356506?v=4)[Alessandro Minoccheri](/maintainers/AlessandroMinoccheri)[@AlessandroMinoccheri](https://github.com/AlessandroMinoccheri)

---

Top Contributors

[![AlessandroMinoccheri](https://avatars.githubusercontent.com/u/3356506?v=4)](https://github.com/AlessandroMinoccheri "AlessandroMinoccheri (35 commits)")[![dudztroyer](https://avatars.githubusercontent.com/u/26704955?v=4)](https://github.com/dudztroyer "dudztroyer (2 commits)")[![HLXCommunity](https://avatars.githubusercontent.com/u/40380493?v=4)](https://github.com/HLXCommunity "HLXCommunity (1 commits)")[![lloricode](https://avatars.githubusercontent.com/u/8251344?v=4)](https://github.com/lloricode "lloricode (1 commits)")[![mullikine](https://avatars.githubusercontent.com/u/1020987?v=4)](https://github.com/mullikine "mullikine (1 commits)")

---

Tags

currencyconvertcodeigniterprice

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alessandrominoccheri-codeigniter-currency-converter/health.svg)

```
[![Health](https://phpackages.com/badges/alessandrominoccheri-codeigniter-currency-converter/health.svg)](https://phpackages.com/packages/alessandrominoccheri-codeigniter-currency-converter)
```

###  Alternatives

[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7865.8M46](/packages/akaunting-laravel-money)[brick/money

Money and currency library

1.9k41.8M148](/packages/brick-money)[florianv/swap

PHP currency conversion library for retrieving exchange rates from 30+ providers, with caching and fallback.

1.3k6.8M23](/packages/florianv-swap)[cknow/laravel-money

Laravel Money

1.0k4.8M30](/packages/cknow-laravel-money)[kwn/number-to-words

Multi language standalone PHP number to words converter. Fully tested, open for extensions and new languages.

4375.4M23](/packages/kwn-number-to-words)[cartalyst/converter

A framework agnostic measurement conversion and formatting package featuring multiple types of measurements and currency conversion.

91488.9k7](/packages/cartalyst-converter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
