Installation
Require the package with Composer. The service provider is auto-discovered — no manual registration:
composer require roundly-consulting/money-for-laravelIf your app disables package discovery, register RoundlyConsulting\Money\MoneyServiceProvider yourself. Don’t skip it: other packages’ migrations call the $table->money() macro and fail without the provider.
// bootstrap/providers.php — only when package discovery is disabled
return [
App\Providers\AppServiceProvider::class,
RoundlyConsulting\Money\MoneyServiceProvider::class,
];Publishing
The config file is optional — every key has a sensible default and the common ones are env-backed. Publish it only to override:
php artisan vendor:publish --tag="money-config"Publish and run the migration only if you use the database (or chain) exchange driver — it creates the money_exchange_rates table. Nothing is auto-loaded:
php artisan vendor:publish --tag="money-migrations"
php artisan migrateOptionally publish the validation messages (English and Slovak ship with the package):
php artisan vendor:publish --tag="money-translations"- money-config — config/money.php.
- money-migrations — the create_money_exchange_rates_table migration, timestamped on publish.
- money-translations — lang/vendor/money/{en,sk}/validation.php.
Before your first money migration
money.schema.currency_length and money.schema.precision are read when migrations run and are fixed afterwards. Set them before running any migration that uses the money column macros — for example, raise currency_length before you store custom codes such as USDT.
At a glance
The package adds a Money section to Laravel’s about command — never provider credentials:
php artisan about # the "Money" section: default currency, currency counts,
# formatter, exchange driver and rate scheduleStatic analysis
A PHPStan extension ships with the package (extension.neon, exposed through extra.phpstan.includes). With phpstan/extension-installer, PHPStan learns the money() / moneyJson() / currencyCode() Blueprint macros, the collection macros and Request::money() automatically.
Show your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.