los / losi18n
I18N middleware providing route and country, region and language lists in all languages
Fund package maintenance!
Requires
- php: ^7.4 || ^8.0
- ext-json: *
- psr/container: ^1.1
Requires (Dev)
- doctrine/coding-standard: ^9.0
- ergebnis/composer-normalize: ^2.13
- phpstan/phpstan: ^0.12.85
- squizlabs/php_codesniffer: ^3.6
- vimeo/psalm: ^4.7
Suggests
- los/losi18n-data: Data files for LosI18n.
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-04 18:17:21 UTC
README
Warning
Archived
This internationalization middleware is no longer maintained and will receive no further releases. Use the maintained localization facilities and locale data provided by your current framework for new applications.
Introduction
This middleware provides list of Languages, Countries and Regions translated to all languages.
Requirements
PHP 7.4 | 8.0 and any container-interopt compatible project.
Installation
composer require los/losi18n
Optionally, copy the config file to your project.
I18n Data
This module needs data from losi18n-data. So you need either to add the module to you project:
Adding the losi18n-data
composer require los/losi18n-data
File format
There are 3 formats: php, json and csv. If you need to import the json file, it's located: vendor/los/losi18n-data/data//languages.json vendor/los/losi18n-data/data//countries.json vendor/los/losi18n-data/data//regions.json
Usage
Language list
$languagesService = $sm->get('losi18n-countries'); // All languages translated to pt_BR $languages = $countriesService->getAllLanguages('pt_BR'); // All languages in their native names $languages = $countriesService->getNativeLanguages(); // Brazilian Portuguese in English $language = $countriesService->getLanguage('pt_BR', 'en);
Country list
$countriesService = $sm->get('losi18n-countries'); // All officially assigned countries translated to English $countries = $countriesService->getAllCountries('en'); // All countries translated to English $countries = $countriesService->getAllCountries('en', false); // United States translated to Brazilian Portuguese $country = $countriesService->getCountry('US','pt_BR');
Region list
$regionsService = $sm->get('losi18n-regions'); $regions = $countriesService->getAllRegions('pt_BR');