Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

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.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Webpatser Laravel Countries Related Articles

RedBerry to Host Georgia's First Laravel Meetup in Tbilisi image

RedBerry to Host Georgia's First Laravel Meetup in Tbilisi

Read article
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
Lucky Media logo

Lucky Media

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

Lucky Media
CodeKudu logo

CodeKudu

Stand-ups, Retrospectives, and 360° Feedback for the entire team. 50% off with code LARAVELNEWS.

CodeKudu
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
PhpStorm logo

PhpStorm

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

PhpStorm
Securing Laravel logo

Securing Laravel

The essential security resource for Laravel devs, covering everything you need to keep your apps secure. Sign up to receive weekly security tips and monthly in depth articles, diving deep into security concepts you need to know!

Securing Laravel