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

Intl Laravel Package

commerceguys/intl

commerceguys/intl is a PHP internationalization library that provides country, currency, language, and locale data with locale-aware formatters. It helps commerce and multilingual apps display consistent, CLDR-based names and currency values.

Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • Plain PHP library with no framework coupling; supplies value objects (Country, Currency, Language, Locale) and repositories backed by CLDR/ISO data.
  • Natural fit as a domain/infrastructure dependency inside a Laravel app, not as a complete i18n solution. It complements Laravel's translation, pluralization, and Number helpers rather than replacing them.
  • Recommended pattern: hide concrete classes behind app-level interfaces (e.g. CurrencyFormatter, CountryResolver) so controllers, Blade, and API resources are not coupled to the vendor API.
  • Value-object style encourages storing ISO codes (USD, US) in the database and resolving display strings at the edge.

Integration feasibility

  • Composer-only installation; PSR-4 autoload; no service provider or config publishing required. Integration effort is mostly a thin wrapper plus conventions.
  • Small, stable API surface: repositories for lookup/validation, formatters for money and numbers.
  • Feasible in a one-to-two day spike: install, format a fixed basket of currencies across 5–10 locales, validate country/currency codes, measure memory of loading full repositories, and confirm intl availability.

Technical risk

  • Data freshness: currency redenominations, new currencies, and country changes are real; stale data becomes a correctness bug, not just a cosmetic one.
  • Server ICU vs bundled CLDR: number/currency formatting can diverge from the package's data depending on the ICU version installed in each environment.
  • Money semantics: display formatting is not the same as accounting rounding, minor-unit handling, or tax calculation; the library formats, it does not do money math.
  • Runtime dependency on the PHP intl extension in web, queue, CLI, and CI images.
  • Low star count (369) but credible Drupal Commerce lineage; metadata shows a future-dated "last release" (2026-09-23), which should be verified against actual tags/Composer metadata before pinning.
  • Symbol ambiguity ($ for USD/CAD/AUD, kr for several currencies) can produce incorrect UI unless locale and currency are always formatted together.

Key questions

  • Which currencies and locales are in scope today, and which are forecast for the next 18 months?
  • Do we need historical currencies and superseded country codes, or only current ISO data?
  • How is money stored today — decimal, float, or integer minor units — and who owns rounding rules?
  • What ICU version is present in production, staging, CI, and local Docker images?
  • Do we also need address formatting/validation (commerceguys/addressing) or only country/currency?
  • Who owns the quarterly review of currency and country data, and what is the acceptable staleness window?
  • Are we comfortable with community/MIT support and no vendor SLA?

Integration Approach

Stack fit

  • Laravel 10/11/12 on PHP 8.1+ aligns with the package's constraints; no framework conflicts.
  • Fits cleanly with Eloquent casts, FormRequest validation, Blade components, API Resource transformers, and localization middleware.
  • Compose with a small application service provider that registers repositories as singletons and exposes a config map for default locale and currency.

Migration path

  • Inventory existing hardcoded country/currency arrays, config/*.php lists, and any direct symfony/intl or NumberFormatter usage.
  • Introduce a CurrencyFormatter / CountryResolver interface first, then swap implementations behind it to keep the change reversible.
  • Normalize persisted data to ISO 4217 currency codes and ISO 3166 country codes; migrate money columns to integer minor units if they are currently floats.
  • Move presentation formatting into Blade components and API resources so formatting logic is not duplicated across controllers.

Compatibility

  • No auto-discovered provider or facade ships with the package; expect to author a ~50-line wrapper.
  • Confirm ext-intl and exact ICU version in every environment; pin the Composer version and lock file.
  • Check PHP/PSR constraints against the app's platform requirements and any polyfills already in use.

Sequencing

  1. Discovery spike and data audit (currencies, locales, storage format, ICU versions).
  2. Wrapper service provider, config, and interfaces.
  3. Validation rules for country and currency codes, wired into FormRequests.
  4. Formatting layer: Blade components, API transformers, and a money value object.
  5. Locale resolution middleware (user preference → request locale → fallback).
  6. Test matrix across locales, CI image parity, and staged rollout behind a feature flag.

Operational Impact

Maintenance

  • Low code churn; most ongoing work is dependency updates and periodic review of currency/country data.
  • Assign a named owner for Composer updates and a quarterly data review; treat currency changes as a release-gated checklist item.

Support

  • Community-maintained under MIT, with strong Drupal Commerce heritage but no vendor SLA.
  • Documentation is functional but thin; expect to build internal examples, a cheat sheet, and wrapper tests to reduce onboarding cost.

Scaling

  • All data is static and in-process; no network calls, no external services, no cache infrastructure required.
  • Repositories are good singleton candidates; memory footprint is bounded and can be measured once and monitored.
  • Formatting is CPU-bound and predictable; horizontal scaling is unaffected.

Failure modes

  • Missing locale or territory falls back silently — output may be English or a default currency symbol, masking bugs.
  • Invalid codes throw exceptions; without try/catch or validation-first patterns, bad user input becomes 500s.
  • ICU/CLDR version drift produces different symbols or decimal separators between web, queue, and CLI workers.
  • Incorrect minor-unit or rounding assumptions cause off-by-100 money bugs that only appear in specific currencies (e.g. JPY, KWD).
  • Divergent locale between request and queued jobs yields inconsistent localized emails and exports.

Ramp-up

  • Low: one to two days for a PHP developer familiar with Composer and Laravel.
  • Required literacy: CLDR concepts (locale vs language vs country), ISO 4217/3166 codes, minor units, and symbol ambiguity.
  • Since docs are thin, plan an internal README with approved formatting patterns and a small test suite as the onboarding artifact.
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.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core