Try Depot: Bring ultra-fast, remote Docker builds directly to your Laravel workflow

Laravel Countries

webpatser/laravel-countries image

Laravel Countries stats

Downloads
1.9M
Stars
718
Open Issues
48
Forks
228

View on GitHub →

Laravel Countries is a bundle for Laravel, providing Almost ISO 3166_2, 3166_3, currency, Capital and more for all countries.

Laravel Countries

Laravel Countries is a bundle for Laravel, providing Almost ISO 3166_2, 3166_3, currency, Capital and more for all countries.

Please note that version 1.4 is Laravel 5 only, older versions of Laravel should use version 1.3.4 instead

Installation

Add webpatser/laravel-countries to composer.json.

"webpatser/laravel-countries": "dev-master"

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

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

'providers' => [
'Webpatser\Countries\CountriesServiceProvider',
]

Now add the alias.

'aliases' => [
'Countries' => 'Webpatser\Countries\CountriesFacade',
]

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 countries suits you, leave it. Otherwise run the following command

$ php artisan vendor:publish

Next generate the migration file:

$ php artisan countries:migration

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

//Seed the countries
$this->call('CountriesSeeder');
$this->command->info('Seeded the countries!');

You may now run it with the artisan migrate command:

$ php artisan migrate --seed

After running this command the filled countries table will be available

webpatser photo

Specializes in building high performance APIs with Laravel/Lumen and Elasticsearch.


Webpatser Laravel Countries Related Articles

Manage Global Data in Laravel with the World Package image

Manage Global Data in Laravel with the World Package

Read article
The State of PHP 2024 image

The State of PHP 2024

Read article
LangCountry launches v4 image

LangCountry launches v4

Read article
Phone Number Formatting, Validation, and Model Casts in Laravel image

Phone Number Formatting, Validation, and Model Casts in Laravel

Read article
Laravel Live Denmark: A Two-Day Event in Copenhagen, Denmark on August 22-23, 2024 image

Laravel Live Denmark: A Two-Day Event in Copenhagen, Denmark on August 22-23, 2024

Read article
LangCountry is a Localization Package for Laravel image

LangCountry is a Localization Package for Laravel

Read article
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media