- Can I use headsnet/money-bundle in a Laravel application?
- Technically you can bridge parts of it into Laravel's container, but the package is built as a Symfony bundle and relies on Symfony's bundle system, DI container compilation, and its Form and Validator contracts. Laravel has no equivalent extension system, so anything you wire up becomes a permanent shim layer that upstream never designed for. For most Laravel projects the realistic answer is to require moneyphp/money directly and rebuild the small pieces you actually need.
- What does headsnet/money-bundle add on top of moneyphp/money?
- It supplies the Symfony integration layer: container-managed services for creating and formatting money, Doctrine types, form types, validators, Twig extensions, serialization support, and configurable defaults for currency and formatting. The actual monetary behaviour, including immutable Money objects, currency handling, parsing, allocation and rounding modes, comes from moneyphp/money. That underlying library is framework-agnostic and PSR-compatible, which is why it ports to Laravel cleanly while the bundle does not.
- How do I install headsnet/money-bundle?
- Install it with Composer via composer require headsnet/money-bundle, then register the bundle in your Symfony kernel and set any currency or formatting defaults in configuration. Installation assumes a Symfony application with the bundle and dependency injection infrastructure already in place. In a Laravel app you would instead require moneyphp/money and skip the bundle entirely.
- Which PHP versions does headsnet/money-bundle support?
- Version 0.2.0 raises the minimum PHP version to 8.1 and claims support for PHP 8.4, while 0.1.12 and earlier remain the only option for environments still on PHP 8.0. The release notes for 0.2.0 are a single line with no CI matrix detail, so treat the 8.4 support claim as something to verify in your own pipeline. This matters for Laravel teams because Laravel 9 still permits PHP 8.0.
- What is the Laravel equivalent of the bundle's Doctrine money types?
- In Laravel you would write an Eloquent cast that maps a database column to a moneyphp/money Money instance, typically storing the amount as an integer of minor units alongside a currency column. That is a small class you own, test and control, and it keeps Doctrine out of a Laravel codebase. The bundle's Doctrine types have no meaning outside Doctrine, so there is nothing to reuse here.
- How do I format currency in Blade instead of Twig?
- The bundle's Twig extensions do not apply in Blade, so register a Blade directive or a small helper class that wraps moneyphp/money's formatter and call it from your views. Because moneyphp/money is framework-agnostic, the formatting logic itself is unchanged. Only the templating adapter is different, which makes this one of the cheaper pieces to rebuild.
- Is there a Laravel validation rule for monetary values?
- Not from this package, because its validators are written against Symfony's Validator component contracts. In Laravel you would write a custom Rule class that parses the input with moneyphp/money's parser and rejects anything that cannot produce a valid Money value for the expected currency. That is a few dozen lines of code and is considerably cheaper than bridging the Symfony validator layer.
- Is headsnet/money-bundle safe to run in production?
- It is a 0.x package maintained by a small group, so assume limited long-term support depth and watch for breaking changes between minor versions. The jump from 0.1.12 to 0.2.0 is breaking despite the minor version number, because it raises the minimum PHP version to 8.1. There is also no published security policy and the release notes are minimal, so pin versions deliberately and review upgrades before shipping them.
- What are the alternatives to headsnet/money-bundle for Laravel?
- The most sensible alternative is moneyphp/money itself, which delivers the same safe, explicit monetary values without framework coupling. You pair it with a locally written Eloquent cast, validation rule and Blade helper to reproduce the features you would genuinely have used from the bundle. Other PHP money libraries exist, but moneyphp/money is exactly what this bundle wraps, so your behaviour stays consistent with the reference implementation.
- How do I upgrade from headsnet/money-bundle 0.1.x to 0.2.0?
- The upgrade is gated on the PHP runtime bump rather than API changes. Inventory PHP versions across the app, queue workers, CI runners and container base images, raise anything on 8.0 to 8.1 or later, then bump the Composer constraint and run the full test suite plus a manual pass over money-handling paths, since a PHP minor bump can surface implicit-nullable and deprecation notices. If any environment cannot move off 8.0, pin to 0.1.12 and treat it as a hard ceiling.