2017 © Pedro Peláez
 

library laravel-country-state

Country & state helper for Laravel 5.1+.

image

dougsisk/laravel-country-state

Country & state helper for Laravel 5.1+.

  • Tuesday, October 17, 2017
  • by DougSisk
  • Repository
  • 1 Watchers
  • 49 Stars
  • 96,302 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 10 Forks
  • 0 Open issues
  • 18 Versions
  • 14 % Grown

The README.md

Laravel Country & State Helper

Latest Stable Version Total Downloads License, (*1)

A helper to list countries & states in English in Laravel 11.0+., (*2)

What's Changed in 5.0

  • PHP 8.2+ required

I'm aware the underlying country/state data package I utilize has not been actively maintained. I've looked into other packages, but have yet to find one that can easily be swapped in. Please feel free to submit a PR if you find one you think is a suitable replacement., (*3)

Installation

Require this package with composer:, (*4)

composer require dougsisk/laravel-country-state

This package will automatically be discovered by Laravel, if enabled. If you don't have auto package discovery on, you'll need to add the following service provider to your config/app.php:, (*5)

DougSisk\CountryState\CountryStateServiceProvider::class,

Copy the package config to your local config with the publish command:, (*6)

php artisan vendor:publish --provider="DougSisk\CountryState\CountryStateServiceProvider" --tag="config"

Configuration

By default, the helper will preload states for the US. You can change this via the preloadCountryStates config option:, (*7)

'preloadCountryStates' => ['CA', 'MX', 'US']

If you don't want every country to be returned, you can define countries using the limitCountries config option:, (*8)

'limitCountries' => ['CA', 'MX', 'US']

Usage

You may now use the CountryState facade to access countries and states., (*9)

Remember to import the namespace to access the facade in your files:, (*10)

use CountryState;

To get an array of countries:, (*11)

$countries = CountryState::getCountries();

The array keys will be the countries' 2 letter ISO code and the values will be the countries' English name. You may also set the 3 letter ISO key as the argument to receive translations of the countries' names (limited support)., (*12)

To get an array of a country's states, simply pass the country's 2 letter ISO code:, (*13)

$states = CountryState::getStates('US');

The array keys will be the states' 2 letter ISO code and the values will be the states' English name., (*14)

License

This library is available under the MIT license., (*15)

The Versions

17/10 2017

dev-master

9999999-dev https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.1+.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

06/10 2017

2.1

2.1.0.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.1+.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

29/06 2017

2.0.4

2.0.4.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.1+.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

26/04 2017

2.0.3

2.0.3.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.1+.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

30/03 2017

2.0.2

2.0.2.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.1+.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

30/03 2017

dev-develop

dev-develop https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.1+.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

09/03 2017

2.0.1

2.0.1.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.1+.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

03/02 2017

2.0

2.0.0.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.1+.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

13/10 2016

1.2.1

1.2.1.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

28/07 2016

1.2

1.2.0.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

18/07 2016

1.1.1

1.1.1.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

28/11 2015

1.1

1.1.0.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel states country countries state

27/11 2015

1.0.5

1.0.5.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.

  Sources   Download

MIT

The Requires

 

laravel states country countries state

27/11 2015

1.0.4

1.0.4.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.

  Sources   Download

MIT

The Requires

 

laravel states country countries state

23/10 2015

1.0.3

1.0.3.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.

  Sources   Download

MIT

The Requires

 

laravel states country countries state

05/10 2015

1.0.1

1.0.1.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.

  Sources   Download

MIT

The Requires

 

laravel states country countries state

05/10 2015

1.0.2

1.0.2.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.

  Sources   Download

MIT

The Requires

 

laravel states country countries state

02/10 2015

1.0

1.0.0.0 https://github.com/DougSisk/laravel-country-state

Country & state helper for Laravel 5.

  Sources   Download

MIT

The Requires

 

laravel states country countries state