This package is abandoned and no longer maintained. The author suggests using the akaunting/laravel-money package instead.

Currency formatting and conversion package for Laravel

5.2.0 2024-03-19 21:43 UTC


Downloads Tests StyleCI License

This package intends to provide tools for formatting and conversion monetary values in an easy, yet powerful way for Laravel projects.

Why not use the moneyphp package?

Because it uses the intl extension for number formatting. intl extension isn't present by default on PHP installs and can give different results in different servers.

Getting Started

1. Install

Run the following command:

composer require akaunting/laravel-money

2. Publish

Publish config file.

php artisan vendor:publish --tag=money

3. Configure

You can change the currencies information of your app from config/money.php file


use Akaunting\Money\Currency;
use Akaunting\Money\Money;

echo Money::USD(500); // '$5.00' unconverted
echo new Money(500, new Currency('USD')); // '$5.00' unconverted
echo Money::USD(500, true); // '$500.00' converted
echo new Money(500, new Currency('USD'), true); // '$500.00' converted


$m1 = Money::USD(500);
$m2 = Money::EUR(500);

$m1->convert(Currency::GBP(), 3.5);
$m1->allocate([1, 1, 1]);


money(500, 'USD')

Blade Directives

@money(500, 'USD')

Blade Component

Same as the directive, there is also a blade component for you to create money and currency in your views:

<x-money amount="500" />
<x-money amount="500" currency="USD" />
<x-money amount="500" currency="USD" convert />

<x-currency currency="USD" />


This package implements the Laravel Macroable trait, allowing macros and mixins on both Money and Currency.

Example use case:

use Akaunting\Money\Currency;
use Akaunting\Money\Money;

    fn () => $this->isPositive() ? $this : $this->multiply(-1)

$money = Money::USD(1000)->multiply(-1);

$absolute = $money->absolute();

Macros can be called statically too:

use Akaunting\Money\Currency;
use Akaunting\Money\Money;

Money::macro('zero', fn (?string $currency = null) => new Money(0, new Currency($currency ?? 'GBP')));

$money = Money::zero();


Along with Macros, Mixins are also supported. This allows merging another classes methods into the Money or Currency class.

Define the mixin class:

use Akaunting\Money\Money;

class CustomMoney 
    public function absolute(): Money
        return $this->isPositive() ? $this : $this->multiply(-1);
    public static function zero(?string $currency = null): Money
        return new Money(0, new Currency($currency ?? 'GBP'));

Register the mixin, by passing an instance of the class:

Money::mixin(new CustomMoney);

The methods from the custom class will be available:

$money = Money::USD(1000)->multiply(-1);
$absolute = $money->absolute();

// Static methods via mixins are supported too:
$money = Money::zero();


Please see Releases for more information on what has changed recently.


Pull requests are more than welcome. You must follow the PSR coding standards.


Please review our security policy on how to report security vulnerabilities.



The MIT License (MIT). Please see LICENSE for more information.