Download the PHP package elegantly/laravel-money without Composer
On this page you can find all versions of the php package elegantly/laravel-money. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download elegantly/laravel-money
More information about elegantly/laravel-money
Files in elegantly/laravel-money
Package laravel-money
Short Description Use Brick/Money in your Laravel app
License MIT
Homepage https://github.com/ElegantEngineeringTech/laravel-money
Informations about the package laravel-money
Elegant Integration of Brick/Money for Laravel
Table of Contents
- Introduction
- Features
- Installation
- Configuration
- Storing Money in the Database
-
Usage
- Casting with a Currency Column (Recommended)
- Casting with a Fixed Currency
- Parsing Values
- Validation Rule
- Testing
- Changelog
- Contributing
- Security
- Credits
- License
Introduction
This package provides seamless, expressive integration of Brick/Money with Laravel. It enables safe, precise handling of monetary values in your application—using value objects, smart casting, robust parsing, and powerful validation tools.
Features
- MoneyCast – Automatically cast Eloquent attributes to
Brick\Money\Money. - MoneyParser – Convert strings, integers, or floats into
Moneyinstances safely. - ValidMoney Rule – Validate monetary input with min/max boundaries, type safety, and nullability.
Installation
Install via Composer:
Configuration
Publish the configuration file if you need to customize defaults:
Default config (config/money.php):
Storing Money in the Database
For maximum precision, store money using:
- a
bigIntegercolumn for the amount (in the smallest currency unit) - a
stringcolumn for the ISO currency code
This avoids floating-point precision issues and ensures accurate calculations.
Example migration:
Usage
Casting with a Currency Column (Recommended)
If your model stores both amount and currency, reference the currency column in the cast:
Casting with a Fixed Currency
If the currency is known and constant, define it directly:
Parsing Values
MoneyParser converts common numeric and string formats into Money instances:
The parser handles nullability, empty strings, integers, floats, and decimal string formats gracefully.
Validation Rule
Using ValidMoney in Livewire
Using ValidMoney in Form Requests
Testing
Run the test suite:
Changelog
See the CHANGELOG for a full history of updates.
Contributing
Contributions are welcome! Review the CONTRIBUTING file for details.
Security
If you discover a security vulnerability, please refer to the security policy.
Credits
- Quentin Gabriele
- All Contributors
License
This package is open-source software released under the MIT License. See LICENSE.md for details.
All versions of laravel-money with dependencies
brick/money Version ^0.13.0
illuminate/contracts Version ^12.0||^13.0
spatie/laravel-package-tools Version ^1.13.0