michael-rubel/laravel-formatters
Laravel Formatters provides a clean, extensible set of formatter classes for common tasks like money, phone numbers, names, dates, and more. Formatters auto-resolve through the container and support method chaining, making consistent formatting simple throughout your app.
number_format(), Carbon::parse()->format(), and inline string concatenation across controllers, models, and Blade, this is a candidate standard to put in your engineering guidelines — with or without the package.Adopt when:
app/Support/helpers.php grab bag.Look elsewhere when:
Number/Str helpers and Carbon's formatters already cover a large slice of this. Adding a dependency for a single Number::currency() call is overkill.intl / NumberFormatter — this package is a wrapper pattern, not a locale engine.moneyphp/money or brick/money for the value-object and math layer; a formatter is the presentation step downstream of that.To executives (30 seconds):
We have a small, recurring class of defects where the same number or date renders differently on different screens — invoices vs. dashboards vs. exports. This is a ~free fix: a tiny MIT-licensed Laravel package that gives us one named place to define how we present money, dates, and contact data. It costs nothing, adds no infrastructure, and if we ever want to drop it, replacing it is roughly a day of work. The real output is a team standard, not a vendor relationship.
To engineering (the honest framing):
It's an interface + abstract base class + a handful of invokable formatter classes, resolved from the container. No runtime overhead, no data-layer coupling, no magic. It gives us a typed seam for presentation logic so formatting stops living in Blade templates and controllers. Two caveats we should accept up front: (1) it's a single-maintainer package with effectively no public dependents, so we pin the version and keep our formatters behind our own namespace so swapping is trivial; (2) it is not a localization or money-math library — if we need CLDR-correct multi-locale output, we wrap
intlinside these formatters rather than expecting the package to do it.
Recommendation: Adopt narrowly — one domain (money display), one sprint, behind an in-house namespace — and measure whether formatting-related inconsistencies stop appearing. If they do, expand to dates and contact data. If the package's surface gets in the way, keep the convention and delete the dependency; that's the cheapest possible failure mode, which is exactly why it's worth trying.
How can I help you explore Laravel packages today?