abbreviation, name, country_code) aligns well with common needs (e.g., forms, dropdowns, API responses).league/address or custom JSON data) and replicate functionality.states table and migration. For new projects, this may be acceptable; for existing ones, schema changes could introduce risk.abbreviation, name) sufficient, or are additional fields (e.g., FIPS codes, time zones) required?Event, Filter—deprecated in later versions).StateRepository that loads data from a static array or JSON).config/states.php).| Step | Laravel 5 | Modern Laravel (8/9/10) | Notes |
|---|---|---|---|
| 1. Install | composer require adrianmejias/laravel-states:~1.0 |
❌ Not recommended | Use alternative (e.g., static array). |
| 2. Register Provider | StatesServiceProvider in config/app.php |
❌ Deprecated | Replace with service binding. |
| 3. Publish Config | php artisan vendor:publish |
❌ Optional | Modern Laravel uses config/states.php. |
| 4. Run Migration | php artisan states:migration + migrate --seed |
❌ Avoid | Use php artisan make:migration for custom table or skip DB. |
| 5. Usage | States::all() or States::find('CA') |
Replace with custom facade/service | Example: app()->make(\App\Services\StateService::class)->get('CA'). |
Filter).fips_code).config/states.php file with raw data or use a package like spatie/array-to-object.States::find('NY') → ['name' => 'New York', ...]).app('cache')->remember()).1.0.0).states table is tiny (~50 rows).app['states'] = require config('states.data')).| Risk | Impact | Mitigation |
|---|---|---|
| Package Abandonment | Data becomes outdated (e.g., new US states/territories). | Use static data or a maintained alternative. |
| Laravel 5 Incompatibility | Breaks in modern Laravel without ref |
How can I help you explore Laravel packages today?