tariq86 / country-list by tariq86
forked from Monarobase/country-list

List of all countries with names and ISO 3166-1 codes in all languages and data formats for Laravel
13,276
7
3
Package Data
Maintainer Username: tariq86
Package Create Date: 2016-07-29
Package Last Update: 2022-04-05
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-20 03:01:15
Package Statistics
Total Downloads: 13,276
Monthly Downloads: 40
Daily Downloads: 2
Total Stars: 7
Total Watchers: 3
Total Forks: 1
Total Open Issues: 0

Country List

Country List is a package for Laravel 4 & 5, which lists all countries with names and ISO 3166-1 codes in all languages and data formats.

Installation

  1. Require package via Composer: composer require tariq86/country-list
  2. If you're using Laravel <= 5.4, open up app/config/app.php and add the service provider to your providers array.
    'providers' => [
        // Other providers...
        Tariq86\CountryList\CountryListServiceProvider::class,
    ]

Now add the alias.

    'aliases' => [
        // Other aliases...
        'Countries' => Tariq86\CountryList\CountryListFacade::class
    ]

Usage

  • Locale (en, en_US, fr, fr_CA...)
    • If no locale is given (or if it is set to null), then the current Laravel app's locale will be used (via \App::getLocale())
  • Format (csv, flags.html, html, json, mysql.sql, php, postgresql.sql, sqlite.sql, sqlserver.sql, txt, xml, yaml)

Get all countries

Route::get('/', function()
{
	return Countries::getList('en', 'json');
});

Get one country

Route::get('/', function()
{
	return Countries::getOne('RU', 'en');
});