Pros:
world.php, enabling tailored implementations.Cons:
sub_region → subregion, route/config updates) suggest breaking changes may require careful migration planning.regions table).country_id, which could complicate soft-deletes or multi-tenancy if not handled.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Database Bloat | High | Seed only required regions (use allowed_countries config). |
| Schema Conflicts | Medium | Customize table names in world.php before publishing. |
| Breaking Changes | Medium | Test upgrades in staging; use --force for config migrations. |
| API Rate Limits | Low | Package is self-hosted; no external API calls. |
| Data Accuracy | Medium | Validate against GeoNames or RESTCountries. |
/api/countries, /api/states, etc., enable consumption by React/Vue or mobile apps.composer require sewidan/world
php artisan vendor:publish --tag=world --force # Overwrite configs if needed
config/world.php:
'allowed_countries' => ['US', 'CA', 'GB'], // Restrict seeding
'tables' => [
'countries' => 'custom_countries',
],
php artisan migrate
php artisan db:seed --class=CountriesSeeder # Lightweight
php artisan install:country US # US-only cities
$countries = World::countries()->get();
$cities = World::cities('US')->get();
GET /api/countries).| Step | Priority | Notes |
|---|---|---|
Configure world.php |
Critical | Define allowed countries/tables. |
| Publish migrations/configs | Critical | Use --force if upgrading. |
| Run migrations | Critical | Ensure no conflicts with existing DB. |
| Seed data incrementally | High | Avoid full seed unless necessary. |
| Implement caching | High | Critical for performance. |
| Test facade/API | High | Validate all endpoints. |
| Integrate with frontend/BFF | Medium | Use API routes for decoupled services. |
Country, State, or City models for additional fields.countries(), states(), etc.
Cache::remember('all_countries', now()->addHours(1), function () {
return World::countries()->get();
});
World::cities('US')->where('name', 'LIKE', '%New%') may be slow. Add full-text indexes or use Elasticsearch for large datasets.| Failure Scenario | Impact | Mitigation
How can I help you explore Laravel packages today?