laravel-money
laravel-money copied to clipboard
💵 Laravel Money is an open source package that provides you a convinient way to work with numbers from database with high precision and use them as monetary objects
Introduction
💵 Laravel Money is an open source package that provides you a convinient way to work with numbers from database with high precision and use them as monetary objects. With this package, you can easily operate, compare, format, and even convert monetary objects to other currencies using external API providers.
Upgrade guide
3.xto4.x
Requirements
- PHP:
^8.1 guzzlehttp/guzzle:^7.5bcmathextension
Installation
composer require postscripton/laravel-money
Publishing
Publish the config file through:
php artisan vendor:publish --provider=PostScription\Money\MoneyServiceProvider
or
php artisan vendor:publish --tag=money
After all, the config file at config/money.php should be modified for your own purposes.
Table of Contents
- ⏰ Quick start
- ✅ Usage
- 🧰 Creating
- 🖨️ Output
- 📄 Cloning
- 🎯 Casting
- 🚨 Validation rule
- 🎨️ Formatting
- 💲 Currencies
- Default currency
- Information
- Position
- Display
- Preferred symbol
- Collection methods
- 💵 Money
- 💲 Currency
- Static methods
Money::setFormatter()Money::of()Money::zero()Money::parse()Money::min()Money::max()Money::avg()Money::sum()
- Object methods
- Getters
getAmount()
- Calculations
add()subtract()multiply()divide()rebase()
- Object manipulations
floor()ceil()absolute()negate()clone()
- Logical operations
- Comparing currencies
isNegative()isPositive()isZero()lessThan()lessThanOrEqual()greaterThan()greaterThanOrEqual()equals()
- Converting to string
- Converting currencies
- Getters
- API rate exchangers
- Add your own
License
Laravel-money is an open-source library under the MIT license.