umpirsky/locale-list
PHP library offering ready-to-use lists of locales, countries, languages, currencies, timezones, scripts and continents. Bundled data and a simple API make it easy to look up, validate and populate select menus, so you can localize apps without maintaining your own reference data.
Architecture fit
vendor/ and decode them.locales table. It is not a substitute for a translation/i18n system (it does not translate UI strings).LocaleRepository-style class so the package is swappable for symfony/intl or an in-house dataset later without touching call sites.Integration feasibility
composer require umpirsky/locale-list, pin the version, done. No PHP extension requirements, no migrations, no external services, no credentials.Rule object for validation, a Blade/Inertia select component, and tests.en-US or en_US style codes. These details determine the normalization code we write around it.Technical risk
pt-BR, zh-Hans, sr-Latn) and POSIX-style codes for OS integration. A generic locale list may not carry every variant we care about, or may carry far more than the product supports.Key questions
Stack fit
config/app.php or bootstrap/providers.php.LocaleRepository::all(string $displayLocale): array, ::name(string $code, string $displayLocale): ?string, ::isSupported(string $code): bool. Bind it as a singleton; back it with Cache::rememberForever() or an in-process static so the file is decoded once per request/worker.Rule (validates locale code on registration/profile update), a Blade component (select options), and optionally an API resource for the frontend to fetch options once and cache client-side.Migration path
intl / Locale::getDisplayName(): this is a determinism-vs-freshness trade. intl follows the server's ICU version (non-deterministic across environments); the package gives an identical snapshot everywhere. Prefer the package where reproducible behavior matters; prefer intl where freshest coverage matters. Do not use both.symfony/intl: that library offers a richer API (scripts, territories, variants) with more maintenance weight. If we only need code → name, the flat dataset is the lighter dependency.Compatibility
en-US vs en_US — add an explicit normalizer), case sensitivity on the code used as a lookup key, and display-locale fallback when the requested display language is missing (fall back to en, then to the code itself).Sequencing
LocaleRepository + caching + normalization + fallback, with unit tests covering missing files and unknown codes.composer.json, add a test asserting the supported-locale subset resolves to a non-null name (catches silent data regressions on upgrade), and record the refresh owner.Maintenance
Support
Português (Brasil) here and Portuguese (Brazil) there?" Document the display-locale fallback chain once and point to it.Scaling
file_get_contents + json_decode per request in a hot path — that's the only realistic way to make this slow. For a select rendered once per page, even the naive version is acceptable.Failure modes
_ vs -) → lookups silently return null and the UI degrades without erroring. Normalize at the boundary and assert it in tests.Ramp-up
How can I help you explore Laravel packages today?