Download the PHP package gboquizosanchez/icu-i18n without Composer

On this page you can find all versions of the php package gboquizosanchez/icu-i18n. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package icu-i18n

i18n # `gboquizosanchez/icu-i18n` **Advanced ICU Internationalization for Laravel** [![Latest Stable Version](https://img.shields.io/packagist/v/gboquizosanchez/icu-i18n.svg)](https://packagist.org/packages/gboquizosanchez/icu-i18n) [![Total Downloads](https://img.shields.io/packagist/dt/gboquizosanchez/icu-i18n.svg)](https://packagist.org/packages/gboquizosanchez/icu-i18n) [![PHP](https://img.shields.io/badge/PHP-%5E8.3-777BB4?logo=php&logoColor=white)](https://packagist.org/packages/gboquizosanchez/icu-i18n) [![Laravel](https://img.shields.io/badge/Laravel-12%20%7C%2013-FF2D20?logo=laravel&logoColor=white)](https://packagist.org/packages/gboquizosanchez/icu-i18n) [![License: MIT](https://img.shields.io/badge/License-MIT-22C55E.svg)](LICENSE.md) [![PHPStan](https://img.shields.io/badge/PHPStan-Level%20Max-blue)](https://phpstan.org/) [![Tests](https://img.shields.io/badge/Tests-Pest%20v4-9C27B0)](https://pestphp.com/) --- *Your app uses `es_MX` but vendor packages only ship `es`? Fixed.* *Complex plurals for Russian, Arabic, Polish and Swahili with zero extra configuration.*

Why this package?

Laravel's built-in translation support works great for simple cases — but falls short in real-world multilingual apps:

Problem Without this package With icu-i18n
Plurals in Russian / Arabic / Polish ❌ Impossible with :count ✅ Native ICU MessageFormat
App in es_MX, vendor only has es ❌ Missing keys or wrong locale ✅ Automatic regional fallback
Currency formatting by locale ❌ Manual formatting {amount, number, currency}
Localized dates ❌ Carbon + extra setup {date, date, long}
Drop-in replacement ✅ Same __(), trans(), @lang

🚀 Features


📦 Installation

Publish the configuration file:

Requirements: PHP ^8.3 · ext-intl · Laravel 12 or 13


🔧 Configuration

The configuration file config/icu.php controls the Regional Fallback Strategy.

How it works

When you request a translation (e.g., __('validation.required')) while your app locale is set to Regional (e.g., es_MX), the translator decides whether to use es_MX or fall back to es based on two rules:

  1. Namespace Allowlist: If the translation namespace is NOT in the namespaces list, it falls back to the base language (es).
  2. File Blocklist: If the translation file is in the files list, it forces the base language (es), even if the namespace is allowlisted.

Default Configuration


📖 Usage

1. ICU MessageFormat

Use standard ICU syntax in your JSON or PHP translation files.

lang/en/messages.php

In your Blade views:

2. Advanced pluralization per language

ICU supports the pluralization rules of every language following the CLDR standard:

Russian — 3 plural forms

Arabic — 6 forms + dual

Polish — 4 plural forms

Slovenian — 4 forms including dual

3. Handling Object Parameters

The translator automatically converts DateTime objects to timestamps and objects implementing __toString() to strings before passing them to the ICU formatter:


🧩 Regional Fallback Examples

Assume App::setLocale('es_MX').

Scenario A: Application Strings

You have a file lang/es_MX/home.php.

Scenario B: Vendor Package

You use a package courier that only has translations in lang/vendor/courier/es/messages.php.

Scenario C: Validation Files

You want to use standard Laravel validation messages which typically exist in lang/es/validation.php, not es_MX.


ICU Syntax Reference

Type Syntax Example
Variable {variable} {name}
Number {var, number} {count, number}
Currency {var, number, currency} {amount, number, currency}
Short date {var, date, short} {date, date, short}
Long date {var, date, long} {date, date, long}
Plural {var, plural, one{} other{}} See examples above
Select {var, select, val1{} other{}} {gender, select, male{} female{} other{}}
# in plural Replaced by the count value {count, plural, other{# items}}

🧪 Testing

This package uses Pest v4 with architecture and Laravel plugins. Static analysis runs via Larastan at the maximum level.

Troubleshooting

If you encounter issues:

  1. Check the logs — Laravel logs may contain helpful error messages.
  2. Verify requirements — Ensure PHP and Laravel versions meet the minimum requirements.
  3. Clear cache — Run php artisan config:clear and php artisan cache:clear.
  4. Open an issueReport bugs or request features.

Contributing

Contributions are welcome! Please feel free to:

Please make sure all tests pass and the code follows the style enforced by Laravel Pint before submitting a PR.


Credits


📄 License

This package is open-source software licensed under the MIT License.


Made with ❤️ for the PHP · Laravel · i18n community

All versions of icu-i18n with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-intl Version *
spatie/laravel-package-tools Version ^1.16
illuminate/support Version ^12.0|^13.0
illuminate/translation Version ^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gboquizosanchez/icu-i18n contains the following files

Loading the files please wait ...