Download the PHP package phpaml/i18n without Composer
On this page you can find all versions of the php package phpaml/i18n. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package i18n
Short Description JSON-first internationalization for PHPAML and AML View.
License MIT
Informations about the package i18n
PHPAML i18n
JSON-first internationalization for PHPAML and AML View.
Status:
0.1.0-beta.1. The translation runtime, locale resolver, fallback behavior, plural forms, and CLI workflow are available for public testing.
PHPAML CLI · AML View
Why PHPAML i18n?
Keep translations in small, nested JSON files and use predictable dot keys from PHP, AML View, or generated applications. PHPAML configures the package for you, while standalone PHP projects can initialize it directly.
- nested JSON catalogs organized by locale and feature;
- variable interpolation and
one/otherplural forms; - explicit fallback locale with diagnosable missing keys;
- locale selection from routes, cookies, or
Accept-Language; - CLI commands to add, validate, inspect, and select locales;
- no external service or runtime dependency.
Install
Or install the package directly:
Five-minute example
Translations live under src/locales/{locale}. Every nested JSON path becomes
a dot key:
aml install i18n configures the translator automatically in a PHPAML
application. Files can be nested freely below each locale. Missing keys fall
back to APP_FALLBACK_LOCALE, then return the key itself so the interface
remains diagnosable.
The command also writes the public project configuration to phpaml.json:
The Framework applies this order on every request and publishes the selected
locale as the locale request attribute and the Content-Language response
header. APP_LOCALE and APP_FALLBACK_LOCALE may override environment-specific
defaults without editing generated runtime configuration.
Plural forms use one and other keys. LocaleResolver can select a supported
locale from a route, cookie or Accept-Language header while always returning a
declared locale.
For a locale selected per request, keep the configured translator as the fallback and run the request inside an isolated context:
within() is nestable, restores the previous translator after exceptions, and
isolates concurrent PHP Fibers. Prefer immutable withLocale() over mutating a
shared translator with use() in long-running applications.
Platform relationship
Tests
License
PHPAML i18n is open-source software licensed under the MIT License.