2017 © Pedro Peláez
 

library currency

Handles currency for Laravel 5.

image

casinelli/currency

Handles currency for Laravel 5.

  • Sunday, January 29, 2017
  • by Casinelli
  • Repository
  • 1 Watchers
  • 17 Stars
  • 8,790 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 79 Forks
  • 1 Open issues
  • 12 Versions
  • 6 % Grown

The README.md

Currency for Laravel 5

Latest Stable Version Total Downloads, (*1)

Handles currency for Laravel 5., (*2)


Installation

To get the latest version of Currency simply require it in your composer.json file., (*3)

"casinelli/currency": "dev-master"

You'll then need to run composer install to download it and have the autoloader updated., (*4)

Once Currency is installed you need to register the service provider with the application. Open up app/config/app.php and find the providers key., (*5)

'providers' => [

    Casinelli\Currency\CurrencyServiceProvider::class,

]

Currency also ships with a facade which provides the static syntax for creating collections. You can register the facade in the aliases key of your app/config/app.php file., (*6)

'aliases' => [

    'Currency' => Casinelli\Currency\Facades\Currency::class,

]

Create configuration file and migration table using artisan, (*7)

$ php artisan vendor:publish

Artisan Commands

Updating Exchange

By default exchange rates are updated from Finance Yahoo.com., (*8)

php artisan currency:update

To update from OpenExchangeRates.org, (*9)

php artisan currency:update --openexchangerates

Note: An API key is needed to use OpenExchangeRates.org. Add yours to the config file., (*10)

Cleanup

Used to clean the Laravel cached exchanged rates and refresh it from the database. Note that cached exchanged rates are cleared after they are updated using one of the command above., (*11)

php artisan currency:cleanup

Rendering

Using the Blade helper, (*12)

@currency(12.00, 'USD')
  • The first parameter is the amount.
  • optional The second parameter is the ISO 4217 currency code. If not set it will use the default set in the config file.
echo Currency::format(12.00, 'USD');

For easy output of rounded values:, (*13)

echo Currency::rounded(12.80);  // Will output $12

// All the parameters
echo Currency::rounded(12.80, 0, 'USD');

Change Log

The Versions

29/01 2017

dev-master

9999999-dev

Handles currency for Laravel 5.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency money laravel5 exchange rate

29/01 2017

dev-develop

dev-develop

Handles currency for Laravel 5.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency money laravel5 exchange rate

29/01 2017

v1.1.2

1.1.2.0

Handles currency for Laravel 5.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency money laravel5 exchange rate

28/01 2017

v1.1.1

1.1.1.0

Handles currency for Laravel 5.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency money laravel5 exchange rate

28/02 2016

v1.0.3

1.0.3.0

Handles currency for Laravel 5.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency money laravel5 exchange rate

12/10 2015

v1.0.2

1.0.2.0

Handles currency for Laravel 5.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency money laravel5 exchange rate

09/04 2015

v1.0.1

1.0.1.0

Handles currency for Laravel 5.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency money laravel5 exchange rate

09/04 2015

v1.0.0

1.0.0.0

Handles currency for Laravel 5.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency money laravel5 exchange rate

02/06 2014

0.1.3

0.1.3.0

This provides Laravel 4 with currency functions.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency laravel4 money exchange rate

30/01 2014

0.1.2

0.1.2.0

This provides Laravel 4 with currency functions.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency laravel4 money exchange rate

04/01 2014

0.1.1

0.1.1.0

This provides Laravel 4 with currency functions.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency laravel4 money exchange rate

29/11 2013

0.1.0

0.1.0.0

This provides Laravel 4 with currency functions.

  Sources   Download

BSD 2-Clause

The Requires

 

laravel currency laravel4 money exchange rate