Download the PHP package phpinnacle/money without Composer
On this page you can find all versions of the php package phpinnacle/money. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpinnacle/money
More information about phpinnacle/money
Files in phpinnacle/money
Package money
Short Description Money value objects with Laravel, Livewire, and Filament integration.
License MIT
Homepage https://github.com/phpinnacle/money
Informations about the package money
Money for Laravel, Livewire, and Filament
phpinnacle/money provides an integer-based Money value object together with currency metadata, locale-aware formatting, Eloquent attributes, Laravel validation, Livewire hydration, and Filament fields.
Features
- Monetary amounts stored as integer minor units.
- ISO 4217 currency validation, names, symbols, and fraction digits.
- Parsing and formatting for decimal input.
- Addition, subtraction, multiplication, percentages, allocation, and comparisons.
- Eloquent multi-column
Attributehelper. - JSON, Wireable, and Livewire synthesizer support.
- Filament
MoneyInput,CurrencyPicker,MoneyColumn, andMoneyRangeFilter. - English, Polish, and Russian translations and money formatting, including Belarusian rubles (
BYN).
Installation
Laravel discovers MoneyServiceProvider automatically. The provider registers the Livewire synthesizer, views, translations, and built-in formatters. The package has no migrations, configuration, or frontend assets.
Creating and calculating money
Operations combining Money values require matching currencies unless the other amount is zero.
Eloquent integration
Store the amount and currency in separate columns:
The model property is hydrated as Money, while writes update both columns.
Filament integration
MoneyInput dehydrates to a Money instance, and MoneyColumn formats one using its currency and subunit. Livewire can bind nested amount and currency properties through the registered synthesizer.
Use greater($minimum) and lesser($maximum) for inclusive bounds, or pass strict: true to exclude the boundary. Both methods, along with equal() and notEqual(), accept integer minor units, a Money value, a full validation attribute path referencing another field, or a closure returning one of these values. For example, ->greater(100)->lesser(1000) accepts amounts from 1.00 to 10.00 USD.
required() requires a positive amount; required(false) or a condition returning false disables that requirement. Explicit comparison bounds still apply. nullable() dehydrates zero to null when the other validation rules permit zero.
Validation
MoneyRule accepts the same literal bounds and field references as MoneyInput. Strings always name another validation attribute; use a Money instance for a decimal literal. The validated value must be a Money instance or an array containing amount and currency. Referenced scalar amounts use the validated value's currency. Missing comparison fields and null values skip comparison; add Laravel presence rules when required. Malformed input and incompatible currencies produce translated validation failures. A zero comparison value remains compatible with any currency.
Testing
License
The MIT License (MIT). See License File.
All versions of money with dependencies
ext-intl Version *
codeat3/blade-phosphor-icons Version ^2.4
filament/filament Version ^4.0|^5.0
kwn/number-to-words Version ^2.12
spatie/laravel-package-tools Version ^1.92
symfony/intl Version ^7.2|^8.0