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

Reference Money Laravel Package

baks-dev/reference-money

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Precision Financial Data Handling: Enables accurate storage/retrieval of monetary values in databases, mitigating floating-point arithmetic errors (e.g., 0.1 + 0.2 ≠ 0.3). Critical for e-commerce, fintech, or any system processing payments/pricing.
  • Database Schema Standardization: Provides a reusable Doctrine-compatible solution for storing monetary values as strings (scaled by 100) to avoid precision loss in SQL queries or calculations.
  • Build vs. Buy: Avoids reinventing a financial data storage layer; leverages a lightweight, MIT-licensed package instead of custom development.
  • Roadmap Alignment: Supports future-proofing for:
    • Multi-currency systems (extensible via custom scaling logic).
    • Compliance with financial regulations requiring exact decimal representation.
    • Integration with Laravel Cashier, Stripe, or other payment gateways.

When to Consider This Package

  • Adopt if:

    • Your app handles monetary values (prices, balances, transactions) and requires 100% precision (e.g., $0.10 + $0.20 = $0.30).
    • Using Doctrine ORM in Laravel/PHP and need a consistent way to store/retrieve scaled integers as strings.
    • Prioritizing simplicity over full-featured libraries (e.g., MoneyPHP) for basic use cases.
    • Team lacks time/resources to implement custom scaling logic (e.g., BigDecimal alternatives).
  • Look elsewhere if:

    • You need multi-currency support out of the box (this package focuses on single-currency scaling).
    • Requiring advanced features like exchange rates, rounding rules, or audit trails (consider MoneyPHP).
    • Using non-Doctrine databases (e.g., Eloquent-only apps; this is ORM-specific).
    • Need real-time calculations (this is storage-focused; compute logic remains manual).

How to Pitch It (Stakeholders)

For Executives: "This package solves a hidden technical debt risk in our financial systems: floating-point errors in databases. By storing monetary values as scaled strings (e.g., '100' for $1.00), we eliminate rounding issues in transactions, payments, or reporting—saving time on bug fixes and improving customer trust. It’s a lightweight, MIT-licensed solution that integrates seamlessly with our existing Doctrine setup, with minimal dev effort. For ~$0 cost, we gain precision and compliance-ready data."

For Engineering: *"This is a Doctrine behavior for monetary values that:

  • Fixes precision: Avoids 0.1 + 0.2 = 0.3000000000000004 errors by storing cents as integers.
  • Works out of the box: Just add the trait to your entity fields (e.g., use ReferenceMoney).
  • Extensible: Can customize scaling factors or add validation logic.
  • Lightweight: No bloat; MIT license means no vendor lock-in.

Use case: Perfect for order totals, wallet balances, or any field where exact decimals matter. Pair it with Laravel’s built-in casting for a full solution."*

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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor