ageekdev/laravel-num
A lightweight Laravel package for number formatting and conversion, offering convenient helpers to present numeric values consistently in your app. Includes a clean API for common number tasks and simple Laravel integration.
composer require ageekdev/laravel-num. As of v2.0.0 this requires PHP 8.2+ and Laravel 11, 12, or 13 — if you are still on Laravel 9/10 or PHP < 8.2, stay pinned to the 1.4.x line until you upgrade the host app.php artisan vendor:publish --tag=laravel-num-config
Num::toWords($amount) inside a Blade view or a PDF generator.config/num.php — it is where default locale and formatting behaviour live, and tweaking it is the fastest way to get sane output for a non-English app.int, decimal) and only convert to words/ordinal text at the presentation layer (Blade, API transformers, PDF/email builders). This keeps the package out of your domain logic and makes it trivial to swap formats later.<x-num-words :value="$invoice->total" />) so views do not depend on the package directly. In JSON responses, call the helper inside an Attribute on your resource rather than a global helper.en, fr, etc. Pass the locale explicitly per call when a single request may produce multiple jurisdictions.app()->setLocale($invoice->locale) before invoking the helper, or pass the locale argument directly.composer update plus bumping "laravel/framework" in composer.json. The main work is in your CI matrix: drop PHP 8.1 and Laravel 9/10 jobs, add 8.2+ and 11/12/13.Num::toWords(1234) style calls in unit tests with the config cached, and add a smoke test that hits your invoice endpoint to catch locale regressions after config changes.composer update will fail for apps that have not upgraded their host framework. Plan the Laravel major upgrade first, then bump this package.^1.4 on legacy branches.config/num.php and see no change, run php artisan config:clear; stale cached config is the most common cause of "wrong output in production but correct locally."setLocale calls made elsewhere (middleware, jobs, tests). Prefer passing the locale explicitly to the helper for anything user-facing.composer.json allow-test matrix; otherwise CI will silently keep testing an unsupported combo.How can I help you explore Laravel packages today?