ijeffro/laravel-cities
Laravel package that provides IATA codes, ISO 3166-3 and country codes for cities worldwide, with a migration generator and seeder to populate a searchable cities table in your Laravel app.
City objects via find, findOrFail, exists, inCountry, search, and options. That means one lookup contract across web, API, and admin tooling instead of three homegrown lists.search()/options() back a typeahead or country→city dependent dropdown without standing up a search service. This is the cheapest way to ship a "pick your origin/destination" or "select your region" flow, and it removes free-text location entry — the single largest source of dirty location data in analytics and CRM.CityCode validation rule lets product enforce "is this a valid city code?" at the form and API boundary. That directly improves the reliability of downstream segmentation, routing logic, and reporting, and reduces support tickets caused by typos like LHR vs LHR or "London" vs "LON".Consider it when:
Look elsewhere or build when:
NYC, LON); if the feature is "which terminal/airport," you need an airport dataset (e.g., OurAirports/OpenFlights) — this is a real and common mismatch worth resolving before commitment.Adoption risk to price in: 11 stars, 0 known dependents, effectively a single maintainer, and "readme"-level maturity metadata. Mitigate by confining the dependency behind a thin internal interface (e.g., our own CityLookup contract wrapping the facade) so a swap or a vendored fork of the dataset is a contained change, and by pinning the version.
For executives: We can standardize location input across the product in days, not a quarter. This package gives us a curated list of city codes with country codes, a validation rule, and a Laravel-native lookup — MIT-licensed, no API fees, no third-party latency in checkout or search, and no new vendor contract. It's a small, replaceable component: we adopt it behind our own interface, so it accelerates the feature without locking us in. The open question I'd flag is coverage — we should confirm it covers the markets in scope before we commit it to the roadmap, because it covers commercially significant cities, not every city.
For engineering: It's a Laravel 12/13, PHP 8.2+ package under the FLAIRUK\Cities namespace, auto-discovered, returning immutable City value objects. You get find/findOrFail/exists/inCountry/search/options in memory, plus a CityCode validation rule — so no migration is required for the common case. If you do want it in the database, the migration, Eloquent model, and idempotent seeder are opt-in via cities:install/cities:seed. It ships with a test suite and GitHub Actions CI. Two things to validate in a spike: data coverage and name handling for our target locales, and long-term stewardship — it's a low-adoption, single-maintainer project, so we wrap it in an internal contract and pin the version; if it stalls, we fork the dataset rather than rewrite the feature.
How can I help you explore Laravel packages today?