Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Money Laravel Package

moneyphp/money

PHP library for handling money and currencies safely. Provides immutable Money and Currency value objects, arithmetic with proper rounding, comparisons, formatting, and allocation. Avoid floating-point errors in financial calculations; works well with PHP and frameworks like Laravel.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit: Strong alignment with Laravel's domain-driven design principles. The immutable Money objects encapsulate business logic cleanly within the domain layer, avoiding leakage into controllers or infrastructure. Works seamlessly with Laravel's service container for currency configuration and formatters.
Integration feasibility: Composer-based installation requires minimal setup. Native support for ISO currency codes and formatters integrates with Laravel's localization system. Can be wrapped in custom value objects or used directly in service layers.
Technical risk: Requires refactoring existing float-based money handling; PHP 7.4+ requirement may affect legacy projects. Potential for subtle bugs if currency conversion rules are misapplied during arithmetic operations.
Key questions: How are current monetary values stored in the database (float vs integer)? What payment gateways or third-party integrations rely on raw float values? Are there legacy systems expecting monetary strings instead of minor-unit integers?

Integration Approach

Stack fit: Ideal for Laravel’s service layer and domain models. Eloquent casts can handle Money objects for DB storage (storing minor units as integers). Middleware can parse input strings into Money objects during request handling.
Migration path: Start with new features using Money objects; incrementally refactor legacy code by creating adapters for existing float-based logic. Use database migrations to convert monetary columns to integer types storing minor units.
Compatibility: Requires PHP 7.4+ and Laravel 8+ for full compatibility. Payment gateway SDKs must support integer-based minor units (e.g., Stripe, PayPal). Verify third-party libraries don’t mutate Money objects.
Sequencing: 1) Install via Composer, 2) Configure currency rules in a service provider, 3) Update DB schema for minor-unit storage, 4) Implement Money in new features, 5) Gradually replace float-based calculations in existing code.

Operational Impact

Maintenance: Low

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport