Weave 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
Laravel Cities

Laravel Cities Laravel Package

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.

View on GitHub
Deep Wiki
Context7

IATA city codes for Laravel: an in-memory lookup API, validation rule and optional database table.

Frequently asked questions about Laravel Cities
How do I install ijeffro/laravel-cities in a Laravel application?
Install it with composer require ijeffro/laravel-cities dev-master, then register ijeffro\Cities\CitiesServiceProvider and the Cities alias in config/app.php for Laravel 5. After that, publish the optional config, generate the migration with php artisan cities:migration, and run composer dump-autoload. Because the README targets Laravel 5, confirm compatibility before using it on newer Laravel versions.
Is ijeffro/laravel-cities compatible with Laravel 8, 9, or 10?
No official compatibility is documented beyond Laravel 5, and the README explicitly says dev-master is for Laravel 5 only. The package uses older service provider and config conventions, so Laravel 8, 9, or 10 integration should be validated in a test branch. You may need a fork or maintenance work to resolve dependency and API differences.
How do I seed the cities table with laravel-cities?
Run php artisan cities:migration and composer dump-autoload to generate the cities migration and CitiesSeeder. Add $this->call('CitiesSeeder') to database/seeds/DatabaseSeeder.php, then run php artisan migrate --seed. The seeder fills the cities table with the package's IATA, ISO 3166-3, and country code data.
What city data does the laravel-cities package provide?
It provides a pre-populated cities table containing IATA city codes, ISO 3166-3 codes, and country codes. The data is intended for validation, travel features, logistics, user profiling, and other location-based Laravel use cases. It does not describe real-time refreshes, so data freshness should be checked for your application.
Can I customize the cities table schema in laravel-cities?
The package lets you publish configuration to change the table name and generates a migration you can edit. You can add columns such as timezone or population, but you must handle schema changes and any existing cities table conflicts manually. The package itself remains read-only and does not provide CRUD or migration updates for custom fields.
How do I query cities by IATA code or country using the Cities facade?
Use the registered Cities facade or the underlying Eloquent model to filter records, for example Cities::where('iata', 'JFK')->first() or a where clause on the country column. Add database indexes for columns used in frequent lookups, especially on large datasets. If a city is missing, decide whether to return a partial match, a validation error, or an external API fallback.
Does laravel-cities support CRUD operations or dynamic city management?
No, the package is read-only and ships a static cities table without CRUD operations. If you need dynamic city management, add custom Eloquent logic or sync with an external source such as an API or scheduled import. Be careful not to overwrite seeded data without a clear migration and update strategy.
Are there tests for laravel-cities, and how should I test an integration?
The package does not include explicit tests, so you should write integration tests around your own queries and validation rules. Cover edge cases such as missing IATA codes, malformed codes, country filters, and duplicate city names. Also test migration and seeding in a fresh database to catch schema or seeder issues early.
What are alternatives to ijeffro/laravel-cities for city and country data?
For country and state data, evaluate actively maintained Laravel packages such as spatie/laravel-country-state, depending on your schema needs. For IATA city codes specifically, consider importing an authoritative dataset from IATA or GeoNames into your own table. A custom import often gives better control over updates, indexes, and licensing than a low-maintenance package.
Is ijeffro/laravel-cities maintained and safe for production?
The package is low-maintenance with minimal updates and a small star count, so long-term support is limited. The dev-master branch targets Laravel 5 only, which creates compatibility and deprecation risk on modern Laravel stacks. For production, pin the dependency, add your own tests, and consider forking or replacing it if you need ongoing data updates.
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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator