Laravel Money
Simple class with Facade to handle money for Laravel 5. The class stores and calculates all money related value (eg: prices etc..) in Laari (Pennies)
Installation
composer require aharen/laravel-money
Configuration
-
Add
MoneyServiceProvider
toproviders
inconfig/app.php
aharen\Money\MoneyServiceProvider::class,
-
Add
Money
Facade toaliases
inconfig/app.php
Money => aharen\Money\MoneyManagerFacade::class,
Usage
Initiate from either Rufiyaa
$money = Money::fromRufiyaa(10);
or Laari
$money = Money::fromLaari(1000);
Addition
Expects the provided ammount to be added in Laari
$money->add(100);
Subtraction
Expects the provided ammount to be subtracted in Laari
$money->subtract(100);
Output
There are 3 output options available:
-
Output in Laari
$money->inLaari();
-
Output in Rufiyaa
$money->inRufiyaa();
-
Output in Rufiyaa and Laari
$money->inRufiyaaAndLaari();