Weave 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

Digittext Laravel Package

andrey-helldar/digittext

DigitText is a PHP package for converting numbers into written words, with locale support and Laravel integration. It helps generate readable amounts and counts for invoices, receipts, contracts, and other documents that need numbers spelled out clearly.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install with Composer (composer require <vendor>/<package>) and let Laravel package discovery register the service provider/facade. Check the Composer constraints before upgrading across major versions.
  • Publish the config file (php artisan vendor:publish --tag=<package-config>) and review the defaults for locale, precision, decimal/group separators, and leading-zero/first-group behaviour.
  • Confirm ext-intl is available if the package relies on ICU number formatting, and make sure config('app.locale') matches the locale you expect for display.
  • First use case: format a stored numeric value for the UI. For example, turn 1234.5 into 1.234,50 for German or 1,234.50 for English using the package’s formatter/facade/helper, then render it in a Blade view or API resource instead of calling number_format() directly.

Implementation Patterns

  • Centralise display formatting. Use the package formatter in Blade components, API resources, and presenters so locale, grouping, and precision stay consistent across the app.
  • Pass locale explicitly. Resolve the user’s locale per request (or from app()->getLocale()) and pass it to the formatter; don’t rely on the server’s default locale.
  • Separate storage from presentation. Keep raw numeric values in the database and model attributes, and format only at the view/API boundary. Avoid storing formatted strings.
  • Set precision by context. Use config defaults for general display, but override per call for money (2 decimals), counts (0), or measurements (3), so one screen doesn’t accidentally round another.
  • Normalise localized input. If users can submit numbers with local group/decimal separators, parse and normalise to a raw numeric value before validation and persistence.
  • Test locale output. Add assertions for en and de plus edge cases: zero with a fractional part, values below 1, large grouped numbers, and trailing-zero precision.
  • Upgrade within 5.x. 5.0.2 is a patch release; update and re-run tests to pick up the German localization and fractional-precision fixes.

Gotchas and Tips

  • 5.0.2 specifically fixes fractional/precision behaviour. It addresses German locale number output, always showing the first group, precision on fractional parts, zero with a fractional part, and loss of digits on fractional parts. If you previously saw .5 instead of 0.5 or truncated decimals, upgrade and add regression tests.
  • Precision is display, not storage. Don’t use formatted output for calculations; keep calculations on raw values and format only at render time.
  • Watch locale fallbacks. Confirm whether the formatter uses app.locale or a package-specific default. German formatting (. grouping, , decimal) is a common source of mismatches.
  • Leading-zero behaviour changed with the first-group fix. If your tests or front-end snapshots expected .5, update them to 0.5 after upgrading.
  • Clear config caches. After changing package config, run php artisan config:clear locally and config:cache in production.
  • Debug against NumberFormatter. If output looks wrong, compare with PHP’s NumberFormatter/ICU directly to determine whether the issue is package config or the intl data version.
  • Use extension points rather than forking. Prefer package-provided macros, custom formatters/parsers, or service bindings for custom locale or formatting rules; re-check diffs if you vendor patches, since 5.0.2 removed unused files and license blocks.
  • Major-version caution. Patch releases like 5.0.2 should be safe, but if you’re coming from 4.x, read the 5.x upgrade guide for breaking changes before updating.
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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle