sokil/php-isocodes
PHP library for ISO code datasets with localized names: countries (ISO 3166-1/2/3), currencies (ISO 4217), languages (ISO 639-3) and scripts (ISO 15924). Supports Gettext or Symfony Translation drivers, with locale configuration.
Strengths:
$country->getFlag().Gaps:
IsoCodesFactory as a singleton, injecting it into controllers/services via dependency injection.trans() helper) via the Symfony Translation Driver, avoiding duplication.cache()->remember()) can wrap database loads to mitigate I/O overhead for repeated queries.php-isocodes-db-i18n or php-isocodes-db-only simplify deployment by eliminating manual updates, ideal for production.update_iso_codes_db.sh, which can be automated in Laravel’s deployment pipeline (e.g., Forge/Envoyer).setlocale), which may fail in shared hosting or containerized environments (e.g., Docker) without explicit locale generation (locale-gen).sokil/php-isocodes) require coordination with Laravel’s release cycle.*-db-i18n variants for stability or automate updates via Composer scripts.uk_UA.utf8)?config/app.php or a dedicated service provider:
$app->singleton(IsoCodesFactory::class, function ($app) {
return new IsoCodesFactory(
storage_path('app/isocodes'),
new SymfonyTranslationDriver($app['path.cache'].'/translations')
);
});
IsoCodes::countries()->getByAlpha2('US')) for concise syntax.trans() helper to support ISO codes (e.g., trans('iso.countries.US')).sokil/php-isocodes-db-i18n for simplicity; store data in storage/app/isocodes.post-install-cmd to Composer:
"scripts": {
"post-install-cmd": [
"@php bin/update_iso_codes_db.sh all storage/app/isocodes"
]
}
$countries = Cache::remember('iso.countries', now()->addDays(7), function () {
return app(IsoCodesFactory::class)->getCountries();
});
php-isocodes equivalents.uk_UA, fr_FR) to validate translation drivers.sokil/php-isocodes-db-i18n in a non-critical module (e.g., country dropdowns).['US' => 'United States'] arrays with $isoCodes->getCountries()->getByAlpha2('US')).deprecated() helper.ext-gettext (common in Linux environments; Windows may need PECL).sokil/php-isocodes-db-i18n.composer update sokil/php-isocodes-db-i18n).update_iso_codes_db.sh in CI/CD (e.g., weekly) or during deployments.composer.json conflict rules to block incompatible versions.setlocale() calls or switch to Symfony Translation Driver.How can I help you explore Laravel packages today?