New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

adrianmejias/laravel-states

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states.
323,172 14

Larablocks Analysis

adrianmejias/laravel-states works with any PHP project: the latest release (v1.2.5, Aug 15, 2021) doesn't depend on Laravel.

Recommendation checks

Not advised

Not advised: marked abandoned on Packagist.

  • Marked abandoned on Packagist
  • No release in the last 12 months (last: Aug 15, 2021)
  • 2,350 downloads a month (needs 10,000)
  • 14 GitHub stars (needs 100)

State

Abandoned
  • Packagist marks this package abandoned.
  • Last stable release: Aug 15, 2021.
  • No releases in the last 12 months.
  • First released: Apr 3, 2015.
  • Monthly downloads: 2,350.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 3, 2026.

Install
composer require adrianmejias/laravel-states
Latest Version:v1.2.5
PHP:>=5.3.0
License:MIT
Last Updated:Aug 15, 2021
Links: GitHub  ·  Packagist
Maintainer: adrianmejias

Laravel States

Laravel States is a bundle for Laravel, providing abbreviation, name and country code for US states.

Currently, I only have US states but additional states from other countries could be added using the country code column.

Please not that this is for Laravel 5 only.

Installation

Add adrianmejias/laravel-states to composer.json.

"adrianmejias/laravel-states": "~1.0"

Run composer update to pull down the latest version of Country List.

Edit app/config/app.php and add the provider and filter

'providers' => [
    AdrianMejias\States\StatesServiceProvider::class,
]

Now add the alias.

'aliases' => [
    'States' => AdrianMejias\States\StatesFacade::class,
]

Model

You can start by publishing the configuration. This is an optional step, it contains the table name and does not need to be altered. If the default name states suits you, leave it. Otherwise run the following command

$ php artisan vendor:publish

Next generate the migration file:

$ php artisan states:migration
$ composer dump-autoload

It will generate the <timestamp>_setup_states_table.php migration and the StatesSeeder.php seeder. To make sure the data is seeded insert the following code in the database/seeds/DatabaseSeeder.php

$this->call(StatesSeeder::class);

You may now run it with the artisan migrate command:

$ php artisan migrate --seed

After running this command the filled states table will be available.

Example

Example blade formatting:

@foreach(States::whereCountryCode('US')->get() as $state)
    {{ $state->name }} {{ $state->country_code }}<br>
@endforeach

Should result in:

Alabama US<br>
Arkansas US<br>
Arizona US<br>
...

Related Packages

dpovshed/zipus

US zipcode static database.

2,301 3
daveawb/understated

A PHP Finite State Machine for Laravel 5+

2,005 30
dougsisk/laravel-country-state

Country & state helper for Laravel.

2,332,432 168
altwaireb/laravel-world

Laravel World, Countries States Cities DB Migration & Seeder

21,570 101
sidm/laravel-subdivisions

Laravel Subdivisions is a bundle for Laravel 4.2, providing what is roughly all...

512 4

Version History

Version Released PHP License
v1.2.5 >=5.3.0 MIT
1.2.4 >=5.3.0 MIT
1.2.3 >=5.3.0 MIT
1.2.2 >=5.3.0 MIT
1.2.1 >=5.3.0 MIT