Skip to content

JesseObrien/openexchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

#OpenExchange

Exchange rate bundle built around http://www.openexchangerates.org

##Installation

Install using artisan for Laravel :

php artisan bundle:install openexchange

OR

Install via github to APPPATH/bundles/ :

git clone git://github.com/JesseObrien/openexchange.git APPPATH/bundles/openexchange

Then

Add openexchange to applications/bundles.php by enabling auto start :

return array('openexchange' => array('auto' => true));

Start using openexchange via the methods outlined below!

##Useage

Basic :

Note: I'm purposefully not rounding numbers to retain accuracy. You can do what you wish with them.

<?php
	echo OpenExchange::convert('GBP'); // Default converts currency to OpenExchange::base();
	0.622336
	
	echo OpenExchange::convert('AUD', 'CAD');
	0.99662440934656

	echo OpenExchange::convert('AUD', 'CAD', 520);
	518.24469286021
	
	echo "Rates as of: ".OpenExchange::timestamp('G:i:s - F j, Y');
	Rates as of: 15:00:53 - May 12, 2012
	

Advanced :

<?php

	// Get the rates object
	$rates = OpenExchange::rates();
	echo $rates->USD;
	1

	// Get a list of all currencies
	$currencies = OpenExchange::currencies();
	echo $currencies->USD;
	United States Dollar
	
	// Get the base currency
	echo OpenExchange::base();
	USD
	
	// Alias
	echo OpenExchange::base_currency();
	USD
	
	// Set a new base currency
	echo Openexchange::base('GBP');
	GBP
	
	// Show the license for openexchangerates.org
	echo OpenExchange::license();
	Data collected from various providers with public-facing APIs; copyright may apply; not for resale; no warranties given. Full license info: http://openexchangerates.org/license/
	
	// Show the disclaimer for openexchangerates.org
	echo OpenExchange::disclaimer();
	This data is collected from various providers and provided free of charge for informational purposes only, with no guarantee whatsoever of accuracy, validity, availability, or fitness for any purpose; use at your own risk. Other than that, have fun! More info: http://openexchangerates.org/terms/
	

About

An OpenExchangeRates.org bundle for the Laravel PHP Framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages