PHPackages                             kazuto/laravel-money - 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. kazuto/laravel-money

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

kazuto/laravel-money
====================

Money Cast and Facade for Laravel

1.2.1(4y ago)04MITPHPPHP ^8.0

Since Oct 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Kazuto/laravel-money)[ Packagist](https://packagist.org/packages/kazuto/laravel-money)[ Docs](https://github.com/kazuto/laravel-money)[ GitHub Sponsors](https://github.com/Kazuto)[ RSS](/packages/kazuto-laravel-money/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (9)Versions (5)Used By (0)

Money Cast and Facade for Laravel
=================================

[](#money-cast-and-facade-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/128545e9042eb5d9cd384dc8db175158ed83e8eec7440153b617698426607de9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b617a75746f2f6c61726176656c2d6d6f6e65792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kazuto/laravel-money)[![GitHub Tests Action Status](https://camo.githubusercontent.com/8f54c746761100fb7e29e8e2bef081136337c1927af1ace9e7ca37abfe0cb9ce/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6b617a75746f2f6c61726176656c2d6d6f6e65792f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/kazuto/laravel-money/actions?query=workflow%3Arun-tests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/fffe76f24adaf358ff3e1af3b07e2e317145f3adb9ce7c64ac6e8b7645cad730/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6b617a75746f2f6c61726176656c2d6d6f6e65792f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/kazuto/laravel-money/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/e4c0506456c8f7672c4fa34ae6c45f858502b4e6bbb3ab59c3a19c0ed95e754f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b617a75746f2f6c61726176656c2d6d6f6e65792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kazuto/laravel-money)

This package adds a money cast and money facade to simplify storing financial values in the database by adding them as an integer column instead of float, double, or decimal, thus eliminating the possibility of floating point errors and resulting miscalculations.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require kazuto/laravel-money
```

You can publish and run the migrations with:

```
php artisan vendor:publish --provider="Kazuto\LaravelMoney\MoneyServiceProvider"
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Kazuto\LaravelMoney\MoneyServiceProvider" --tag="money-config"
```

This is the contents of the published config file:

```
return [
  'locale_iso' => 'en_US'
];
```

Usage
-----

[](#usage)

```
// Base
Money::fromInt(524)->toInt();   // 524
Money::fromInt(524)->toFloat(); // 5.24
Money::fromInt(524)->toText();  // $5.24
Money::fromInt(524)->toArray();
// [
//   'value' => 524,
//   'formatted' => '$5.24',
//   'currency' => 'USD',
//   'symbol' => '$',
// ]

Money::fromFloat(5.24)->toInt();    // 524
Money::fromFloat(5.24)->toFloat();  // 5.24
Money::fromFloat(5.24)->toText();   // $5.24
Money::fromFloat(5.24)->toArray();
// [
//   'value' => 524,
//   'formatted' => '$5.24',
//   'currency' => 'USD',
//   'symbol' => '$',
// ]

// Math

// add(Money|int|float)
Money::fromInt(524)->add(123);                    // 647
Money::fromInt(524)->add(1.23);                   // 647
Money::fromInt(524)->add(Money::fromFloat(1.23)); // 647

// substract(Money|int|float)
Money::fromInt(524)->substract(123);                    // 401
Money::fromInt(524)->substract(1.23);                   // 401
Money::fromInt(524)->substract(Money::fromFloat(1.23)); // 401

// multiply(int|float)
Money::fromInt(524)->multiply(2);     // 1048
Money::fromInt(524)->multiply(1.23);  // 645 (rounded from 644.52)

// divide(int|float)
Money::fromInt(524)->divide(2);       // 262
Money::fromInt(524)->divide(1.23);    // 426 (rounded from 426.01)

// Comparisons

// isEqualTo(Money|int|float)
Money::fromInt(524)->isEqualTo(524);                    // true
Money::fromInt(524)->isEqualTo(Money::fromFloat(5.24)); // true
Money::fromInt(524)->isEqualTo(1.23);                   // false
Money::fromInt(524)->isEqualTo(Money::fromInt(123));    // false

// isGreaterThan(Money|int|float)
Money::fromInt(524)->isGreaterThan(123);                    // true
Money::fromInt(524)->isGreaterThan(Money::fromFloat(1.23)); // true
Money::fromInt(524)->isGreaterThan(8.58);                   // false
Money::fromInt(524)->isGreaterThan(Money::fromInt(858));    // false
Money::fromInt(524)->isGreaterThan(524);                    // false
Money::fromInt(524)->isGreaterThan(Money::fromFloat(5.24)); // false

// isGreaterThanOrEqual(Money|int|float)
Money::fromInt(524)->isGreaterThanOrEqual(8.58);                   // false
Money::fromInt(524)->isGreaterThanOrEqual(524);                    // true
Money::fromInt(524)->isGreaterThanOrEqual(Money::fromFloat(5.24)); // true

// isLessThan(Money|int|float)
Money::fromInt(524)->isLessThan(8.58);                   // true
Money::fromInt(524)->isLessThan(Money::fromInt(858));    // true
Money::fromInt(524)->isLessThan(123);                    // false
Money::fromInt(524)->isLessThan(Money::fromFloat(1.23)); // false
Money::fromInt(524)->isLessThan(524);                    // false
Money::fromInt(524)->isLessThan(Money::fromFloat(5.24)); // false

// isLessThanOrEqual(Money|int|float)
Money::fromInt(524)->isLessThanOrEqual(2.24);                   // false
Money::fromInt(524)->isLessThanOrEqual(524);                    // true
Money::fromInt(524)->isLessThanOrEqual(Money::fromFloat(5.24)); // true
```

Testing
-------

[](#testing)

```
# Unit Tests
composer test:run

# Coverage
composer test:coverage
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Kai Mayer](https://github.com/Kazuto)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~37 days

Total

4

Last Release

1602d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25435034?v=4)[Kai Mayer](/maintainers/Kazuto)[@Kazuto](https://github.com/Kazuto)

---

Top Contributors

[![Kazuto](https://avatars.githubusercontent.com/u/25435034?v=4)](https://github.com/Kazuto "Kazuto (5 commits)")

---

Tags

laravelmoneyKazuto

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/kazuto-laravel-money/health.svg)

```
[![Health](https://phpackages.com/badges/kazuto-laravel-money/health.svg)](https://phpackages.com/packages/kazuto-laravel-money)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

199.4k](/packages/tarfin-labs-event-machine)[tapp/filament-form-builder

User facing form builder using Filament components

132.4k3](/packages/tapp-filament-form-builder)

PHPackages © 2026

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