Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Native Country Names

Native Country Names Laravel Package

laravel-lang/native-country-names

Laravel package providing country names in their native languages for localized UIs and forms. Part of the Laravel Lang ecosystem, install via Composer and use alongside your app’s localization setup. MIT licensed.

View on GitHub
Deep Wiki
Context7

The project contains native translations of country names

Frequently asked questions about Native Country Names
How do I install this package for Laravel 12 or 13?
Run `composer require laravel-lang/native-country-names` in your project. The package auto-detects Laravel 9–13 and requires no additional configuration. Register the service provider in `config/app.php` if not using Laravel 5.8+ auto-discovery.
Does this package support custom country naming conventions (e.g., abbreviations, internal codes)?
The package uses ISO 3166-1 standards by default. For custom conventions, extend the facade or override translations in your `resources/lang` folder. Example: Add `country_names.json` with your preferred keys and merge it into the package’s data.
Will this work with my existing Laravel translation system (e.g., `trans()`)?
Yes. The package integrates with Laravel’s localization stack. Use `Country::name('US', 'fr')` for native names or `trans('country_names.US')` for mixed workflows. Both methods respect the app’s current locale or allow manual overrides.
How do I cache country names to improve performance in high-traffic apps?
Wrap `Country::all()` in Laravel’s cache: `Cache::remember('country_names', now()->addHours(24), function() { return Country::all(); })`. For serverless environments (e.g., Vapor), cache at the edge or use a CDN to reduce cold-start impact.
Are there any breaking changes between versions, and how do I future-proof my code?
Minor breaking changes (e.g., `nativeName` → `native` in v1.2.0) are documented. Pin to a stable release (e.g., `^1.8`) and test critical locales. Monitor the [GitHub releases](https://github.com/Laravel-Lang/native-country-names/releases) for updates.
Can I use this package for CLI tools or non-Web Laravel apps?
Yes. The facade API works in any Laravel context, including Artisan commands and queues. Set the locale via `app()->setLocale('es')` or pass it directly to `Country::name('DE', 'es')` for CLI-specific use cases.
What if my app needs real-time country name updates (e.g., political changes)?
This package uses a static JSON dataset, so it’s not real-time. For dynamic updates, consider a third-party API like RESTCountries or self-host a cron-job to sync with an external source. The package’s facade can be extended to support hybrid workflows.
How do I test this package in my CI/CD pipeline?
Include PHPUnit tests for critical locales, e.g., `assertEquals('États-Unis', Country::name('US', 'fr'));`. The package ships with tests; extend them in your `tests/Feature` directory. Mock the `Country` facade for isolated testing.
Are there alternatives to this package, and when should I choose them?
Alternatives include self-hosted JSON files, RESTCountries API, or Laravel’s built-in `trans()` with manual JSON. Use this package if you need 100+ locales with zero API calls or DB queries. Choose an API if real-time updates are critical or a custom solution if you need non-ISO names.
How do I contribute or request missing locales/subdivisions?
Check the [CONTRIBUTING guide](https://laravel-lang.com/contributions.html) for dataset updates. Submit PRs via GitHub or sponsor new locales on [Boosty](https://boosty.to/laravel-lang). For subdivisions (e.g., states), consider extending the package or using a dedicated library like `league/iso3166`.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony