snoeren-development/laravel-currency-casting
Laravel Currency Casting provides an Eloquent cast that stores monetary values as integers and exposes them as currency-aware objects, so you can format, convert, and calculate prices cleanly across your models without scattering money-handling logic throughout your application.
Architecture fit. This is a narrow, single-purpose package: an Eloquent cast that maps an integer column to a Money object on read and back to an integer on write. Architecturally it is a presentation/serialisation-layer concern, not infrastructure — it touches model attribute access, not request lifecycle, queue consumers, or service-provider boot order. That makes it low blast radius and easy to reason about, but it also means the package's value is entirely determined by two questions a TPM should escalate immediately: which Money library it wraps (brick/money, moneyphp/money, or a bespoke value object), and whether it exposes a proper Money object or a raw float. The description is ambiguous ("casts … to floats automatically" versus "work with Money objects"). For any product handling money, float arithmetic in application code is a correctness risk, not a style preference, so this distinction drives the adopt/hold decision more than anything else in the repo.
Integration feasibility. Trivially installable on any Laravel app already storing minor units as integers. The realistic adoption is incremental — apply the cast to one or two models, verify formatting and rounding match current behaviour, then widen. The awkward case is greenfield schema design: if the team is choosing storage format now, this package presumes integer minor units, which is the right default but should be an explicit decision, not inherited from a package. The non-trivial case is retrofitting an app that stores decimals or strings — that is a data migration, not a cast change, and should be scoped separately.
Technical risk.
toArray()/toJson() output. If an API currently serves integer cents and starts serving 12.34, that is a breaking consumer change hiding inside a "refactor."Key questions for the maintainer.
composer.json?Stack fit. Fits any Laravel app with monetary attributes stored as integers. It is a convenience layer, not a dependency that other parts of the system build on, so it can be adopted or removed per-model with minimal coupling. Treat it as an optional ergonomics improvement, not an architectural commitment.
Migration path. Additive and reversible if storage is already integer minor units — add the cast, run the host app's suite, ship. If the app currently stores decimals or formatted strings, stop: that is a data-model migration with backfill and reconciliation, and should be its own initiative with its own budget. Separately, upgrading the package to v1.11.0 is a low-risk patch bump that removes it from any Laravel 13 blocker list — schedule it on normal dependency cadence, not as a project.
Compatibility. Verify against actual locked versions, not the README: PHP floor in the runtime image, laravel/framework, and the Money library if the team already depends on one (version conflicts here are the likely Composer failure). Check whether the package's CI actually tests the Laravel versions the team runs. And audit serialisation: anything consuming these models over JSON must be checked for type changes.
Sequencing.
toArray() output before and after.Maintenance. Ongoing cost is near zero if adopted — the package has no runtime footprint. The real consideration is ownership: a five-star, single-maintainer dependency is a candidate for in-housing precisely because reimplementing an integer-to-Money cast is small and removes the bus-factor risk entirely. If the team's dependency policy has a minimum-adoption or maintainer-redundancy threshold, this package likely fails it, and the build-vs-buy decision should be made deliberately rather than defaulted.
Support. The realistic ticket class is "the number displayed or persisted differs from what we expected" — a rounding or units-mismatch bug. That is a host-app debugging problem, and the team should own the domain knowledge (minor units, rounding policy, per-currency rules) rather than lean on a small upstream. Establish whether the maintainer treats rounding discrepancies as in-scope bugs; assume not.
Scaling. No scaling implications. The cast is per-attribute and allocation-cheap; it does not touch query patterns, memory, or throughput at any meaningful volume.
Failure modes. Ranked by likelihood:
Ramp-up. Near zero — engineers already comfortable with Eloquent casts need no new concepts. The knowledge investment is in the money domain (minor units, rounding, per-currency formatting), which the team should own regardless of whether this package is adopted.
How can I help you explore Laravel packages today?