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

Locale Laravel Package

giggsey/locale

Up-to-date Unicode CLDR locale data packaged as native PHP arrays. Created to avoid requiring the PHP intl extension and to provide newer locale data than many operating systems ship. Used primarily by libphonenumber-for-php (GeoCoder support).

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Locale
How do I install giggsey/locale in a Laravel project?
Run `composer require giggsey/locale` in your project directory. The package is dependency-free and integrates seamlessly with Laravel’s service container. No additional configuration is needed unless you’re using the facade.
Does this package work with Laravel’s built-in localization (trans(), App::setLocale())?
Yes. While it doesn’t replace Laravel’s core localization, it enhances it by providing CLDR-compliant country/region names for dynamic display (e.g., `Locale::getCountryName('US', 'en')` returns 'United States'). Use it alongside `trans()` for hybrid systems.
Can I use giggsey/locale for form validation (e.g., country dropdowns with human-readable labels)?
Absolutely. The package includes methods like `getCountryName()` to convert country codes (e.g., 'US') to localized names (e.g., 'United States'). Integrate it with Laravel’s validation rules for user-friendly error messages.
What Laravel versions does giggsey/locale support?
The package supports Laravel 8+ (PHP 8.1+) and older versions (e.g., v2.0 for PHP 7.x). Check the [README](https://github.com/giggsey/Locale) for version-specific requirements. Laravel 10+ users should verify PHP 8.2 compatibility.
How often does the CLDR data update, and will it break my app?
CLDR data updates are versioned (e.g., v48.1.0). Pin the package version (e.g., `^2.9`) to avoid breaking changes. Major updates may require testing, but the API remains stable. Use `composer update giggsey/locale` cautiously.
Is giggsey/locale compatible with libphonenumber-for-php for phone number parsing?
Yes, this package was created to support `libphonenumber-for-php`’s GeoCoder without requiring the PHP `intl` extension. It provides the same CLDR data but as portable PHP arrays, ensuring consistency across environments.
Can I use this package in a serverless environment (e.g., AWS Lambda)?
Yes, but note the ~1-2MB payload. For serverless, consider caching CLDR data in Redis or a database to reduce memory usage. The package’s modular API lets you load only the data you need (e.g., `getCountries()`).
What if I only need country names and not the full CLDR dataset?
The package is modular. Use methods like `getCountries()` or `getTerritories()` to fetch subsets of data. Avoid loading the full dataset if your app doesn’t need it, reducing memory overhead.
How do I expose CLDR data to my frontend (Vue/React/Alpine.js)?
Create a Laravel API endpoint (e.g., `/api/locales`) returning the data from `Locale::getSupportedLocales()`. Use Laravel’s API resources or JSON responses. For Livewire, bind the data directly to components.
Are there alternatives to giggsey/locale for CLDR data in Laravel?
Alternatives include the PHP `intl` extension (if available) or packages like `symfony/intl` (requires CLDR data files). However, giggsey/locale is unique in bundling up-to-date CLDR as native PHP arrays without extension dependencies.
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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor