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

World Laravel Package

emiliopedrollo/world

Laravel package providing a complete world dataset: countries, states, cities, timezones, currencies, and languages. Query via a World facade or built-in API routes with filters and field expansion, backed by migrations and a seeder for populating the database.

View on GitHub
Deep Wiki
Context7

A Laravel package which provides a list of the countries, states, cities, currencies, timezones and languages.

Frequently asked questions about World
How do I install and set up the World package in Laravel?
Run `composer require nnjeim/world`, publish the config with `php artisan vendor:publish --tag=world`, then execute migrations and the seeder: `php artisan migrate` followed by `php artisan db:seed --class=WorldSeeder`. The seeder takes ~15 minutes to populate the database.
What Laravel versions does this package support?
The package is designed for Laravel 8.x and 9.x. Check the package’s `composer.json` or changelog for specific version compatibility details, as newer Laravel releases may require updates.
Can I customize the database tables or fields used by the package?
Yes, you can customize table names and enable/disable optional fields by editing the `world.php` config file after publishing the package assets. This allows you to align the schema with your existing database structure.
How do I fetch countries with their states and cities using the Facade?
Use `World::countries(['fields' => 'states,cities', 'filters' => ['iso2' => 'FR']])` to fetch France with its states and cities. The response will include nested arrays for states and cities under each country object.
Does the package support filtering and pagination for API routes?
The package supports filtering via query parameters like `/api/countries?filters[iso2]=FR` but does not include built-in pagination. You’ll need to implement pagination manually in your API routes or queries.
Will this package work in a production environment with high traffic?
The package is database-backed, so performance depends on your server’s resources and database optimization. For high-traffic apps, consider caching frequently accessed data (e.g., countries) in Redis or implementing database indexing for large datasets like cities.
How often is the dataset updated, and can I sync it automatically?
The dataset is static and requires manual seeding via `php artisan db:seed --class=WorldSeeder`. There’s no built-in sync mechanism, so updates (e.g., new countries or currencies) must be handled manually or via custom scripts polling an external API.
Are there alternatives to this package for Laravel geopolitical data?
Yes, alternatives include `spatie/laravel-countries` (focused on countries) or `laravel-world/laravel-world` (similar scope). Evaluate based on your needs—some packages offer real-time sync or lighter-weight solutions like JSON files with caching.
How do I handle API route conflicts with existing Laravel routes?
The package registers routes under `/api/`. To avoid conflicts, either namespace your routes or prefix them (e.g., `/geo/api/countries`). Check your `routes/api.php` for existing routes and adjust accordingly.
Can I extend the package to add custom fields or validation logic?
The package allows customization via the `world.php` config, but extending it to add custom fields or validation requires manual code changes. You’d need to modify the seeder, migrations, or facade logic to support additional logic or constraints.
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.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope