All Projects → DougSisk → Laravel Country State

DougSisk / Laravel Country State

Licence: mit
A helper to list countries & states in English in Laravel 5.1+

Projects that are alternatives of or similar to Laravel Country State

Laravel World
provide countries, states, and cities relations and database.
Stars: ✭ 222 (+188.31%)
Mutual labels:  laravel, country, state
Countries States Cities Database
🌍 World countries, states, regions, provinces, cities, towns in JSON, SQL, XML, PLIST, YAML, and CSV. All Countries, States, Cities with ISO2, ISO3, Country Code, Phone Code, Capital, Native Language, Timezones, Latitude, Longitude, Region, Subregion, Flag Emoji, and Currency. #countries #states #cities
Stars: ✭ 1,130 (+1367.53%)
Mutual labels:  countries, country, state
Countries
Laravel countries and currencies
Stars: ✭ 1,564 (+1931.17%)
Mutual labels:  laravel, countries
Laravel cities
Find any country/city in the world. Get Long/Lat etc. Deploy geonames.org database localy. Optimized DB tree
Stars: ✭ 133 (+72.73%)
Mutual labels:  laravel, countries
csc picker
A flutter package to display a country, states, and cities. In addition it gives the possibility to select a list of countries, States and Cities depends on Selected, also you can search country, state, and city all around the world.
Stars: ✭ 25 (-67.53%)
Mutual labels:  country, state
Country Ip Blocks
CIDR country-level IP data, straight from the Regional Internet Registries, updated hourly.
Stars: ✭ 100 (+29.87%)
Mutual labels:  countries, country
Laravel Location
A simple Laravel Package to sort Countries, States and Cities
Stars: ✭ 162 (+110.39%)
Mutual labels:  laravel, country
Circle Flags
A collection of 300+ minimal circular SVG country flags
Stars: ✭ 139 (+80.52%)
Mutual labels:  countries, country
flagpack
A lightweight flag icon toolkit for the web.
Stars: ✭ 51 (-33.77%)
Mutual labels:  country, countries
world
A Laravel package which provides a list of the countries, states, cities, currencies, timezones and languages.
Stars: ✭ 479 (+522.08%)
Mutual labels:  country, countries
react-vector-maps
🗺 A React component for interactive vector maps of the world and 100+ countries
Stars: ✭ 112 (+45.45%)
Mutual labels:  country, countries
Nager.Country
Worldwide Country Informations (ISO-3166-1 Alpha2, ISO-3166-1 Alpha3, ISO 639-1)
Stars: ✭ 68 (-11.69%)
Mutual labels:  country, countries
Country Json
A simple data of the world by country each in JSON format.
Stars: ✭ 688 (+793.51%)
Mutual labels:  countries, country
Tr Geozones
Ülkeler ve Türkiye İl İlçe Semt Mahalle ve Posta Kodu Veritabanı (Laravel)
Stars: ✭ 46 (-40.26%)
Mutual labels:  laravel, state
Reactnativelaravellogin
Sample App for login using laravel 5.5 React Native and Redux
Stars: ✭ 75 (-2.6%)
Mutual labels:  laravel
Laravel 5 Messenger
A Simple Laravel 5, 6, 7 & 8 Messenger with Pusher Capabilities
Stars: ✭ 75 (-2.6%)
Mutual labels:  laravel
Pingcrm Svelte
🦊 Ping CRM Svelte - A demo app to illustrate how Inertia.js works with Laravel and Svelte (hosted on a heroku free dyno).
Stars: ✭ 74 (-3.9%)
Mutual labels:  laravel
Elastic Scout Driver
Elasticsearch driver for Laravel Scout
Stars: ✭ 74 (-3.9%)
Mutual labels:  laravel
Country List
Provides a View Controller with Country List along with Calling Code and Country Code.
Stars: ✭ 76 (-1.3%)
Mutual labels:  countries
Laravel Apps
Laravel multi-application support.
Stars: ✭ 75 (-2.6%)
Mutual labels:  laravel

Laravel Country & State Helper

SensioLabsInsight Latest Stable Version Total Downloads License

A helper to list countries & states in English in Laravel 6.0+.

What's Changed in 4.0

  • PHP 7.4+ or 8.0+ required

Installation

Require this package with composer:

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:

DougSisk\CountryState\CountryStateServiceProvider::class,

Copy the package config to your local config with the publish command:

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:

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

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

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

Usage

You may now use the CountryState facade to access countries and states.

Remember to import the namespace to access the facade in your files:

use CountryState;

To get an array of countries:

$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).

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

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

The array keys will be the states' 2 letter ISO code and the values will be the states' English name.

License

This library is available under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].