Laravel countries and currencies

Overview

Countries

World Map

Latest Stable Version License Code Quality Build

Coverage PHP Downloads StyleCI

What does it gives you?

This package has all sorts of information about countries:

info items
taxes 32
geometry maps 248
topology maps 248
currencies 256
countries 266
timezones 423
borders 649
flags 1,570
states 4,526
cities 7,376
timezones times 81,153

Geology and topology maps

Amongst many other information you'll be able to plot country maps:

Switzerland

Requirements

  • PHP 7.0+

Installing

Use Composer to install it:

composer require pragmarx/countries

Instantiating

use PragmaRX\Countries\Package\Countries;

$countries = new Countries();

echo $countries->where('cca2', 'IT')->first()->hydrateCurrencies()->currencies->EUR->coins->frequent->first();

// or calling it statically

echo Countries::where('cca2', 'IT')->first()->hydrateCurrencies()->currencies->EUR->coins->frequent->first();

Should both return

€1

Overloading the default configuration:

use PragmaRX\Countries\Package\Services\Config;

$countries = new Countries(new Config([
    'hydrate' => [
        'elements' => [
            'currencies' => true,
            'flag' => true,
            'timezones' => true,
        ],
    ],
]));

Usage

This package is not tied to Laravel and doesn't require it to be installed (we have a bridge for this purpose), but it has Laravel Collections in its core, all methods in Collections are available, this way you can do things like filter, map, reduce, search, sort, reject, and a lot more. It, actually, uses Coollection, which is Laravel Collections with a fluent syntax, allowing us to have access to array keys (and values) as object properties.

To get all countries in the data base you just have to:

use PragmaRX\Countries\Package\Countries;

$countries = new Countries();

$all = $countries->all();

To get a json you:

return $countries->toJson();

Filter by keys and values:

$countries->where('name.common', 'Brazil');

Will find Brazil by its common name, which is a

#items: array:22 [▼
  "name" => array:3 [▼
    "common" => "Brazil"
    "official" => "Federative Republic of Brazil"
    "native" => array:1 [▼
      "por" => array:2 [▼
        "official" => "República Federativa do Brasil"
        "common" => "Brasil"
      ]
    ]
  ]

Or alternatively you can filter like this

$countries->whereNameCommon('Brazil');

And, you can go deepeer

$countries->where('name.native.por.common', 'Brasil');

Or search by the country top level domain

$countries->where('tld.0', '.ch');

To get

"name" => array:3 [▼
  "common" => "Switzerland"
  "official" => "Swiss Confederation"
  "native" => array:4 [▶]
]
"tld" => array:1 [▼
  0 => ".ch"
]

And use things like pluck

$countries->where('cca3', 'USA')->first()->hydrateStates()->states->pluck('name', 'postal')->toArray();

To get

"MA" => "Massachusetts"
"MN" => "Minnesota"
"MT" => "Montana"
"ND" => "North Dakota"
...

The package uses a modified Collection which allows you to access properties and methods as objects:

$countries->where('cca3', 'FRA')
         ->first()
         ->borders
         ->first()
         ->name
         ->official;

Should give

Principality of Andorra

Borders hydration is disabled by default, but you can have your borders hydrated easily by calling the hydrate method:

$countries->where('name.common', 'United Kingdom')
         ->hydrate('borders')
         ->first()
         ->borders
         ->reverse()
         ->first()
         ->name
         ->common;

Should return

Ireland

Hydration

To improve performance, hydration, which is enabled by default, can be disable on most country properties, and this is how you manually hydrate properties:

$countries->where('name.common', 'United States')->first()->hydrate('timezones')->timezones->first()->zone_name;

$countries->where('name.common', 'United States')->first()->hydrate('timezones')->timezones->first()->zone_name;

Those are some of the hydratable properties:

  • Borders
  • Cities
  • Currencies
  • Flag
  • Geometry
  • Languages
  • States
  • Taxes
  • Timezone
  • Topology

Extra where rules

Some properties are stored differently and we therefore need special rules for accessing them, these properties are

  • ISO639_3 => The 3 letter language code.
  • ISO4217 => The 3 letter currency code.

You can of course access them like other properties

$countries->whereISO639_3('por')->count();
$countries->where('ISO639_3', 'por')->count();

Mapping

Sometimes you would like to access a property by a different name, this can be done in settings, this way

'maps' => [
    'lca3' => 'ISO639_3'
]

Here we bind the language 3 letter short code ISO format to lca3, which is short for language code alpha 3-letter. So now we can access the property by

$countries->whereLca3('por');

Or

$countries->where('lca3', 'por');

Some other examples from Laravel News and some other contributors

Generate a list of all countries with code, using native name and common

app(PragmaRX\Countries\Package\Countries::class)
->all()
->map(function ($country) {
    $commonName = $country->name->common;

    $languages = $country->languages ?? collect();

    $language = $languages->keys()->first() ?? null;

    $nativeNames = $country->name->native ?? null;

    if (
        filled($language) &&
            filled($nativeNames) &&
            filled($nativeNames[$language]) ?? null
    ) {
        $native = $nativeNames[$language]['common'] ?? null;
    }

    if (blank($native ?? null) && filled($nativeNames)) {
        $native = $nativeNames->first()['common'] ?? null;
    }

    $native = $native ?? $commonName;

    if ($native !== $commonName && filled($native)) {
        $native = "$native ($commonName)";
    }

    return [$country->cca2 => $native];
})
->values()
->toArray();

Should give you 267 (or so) countries like:

"AW" => "Aruba"
"AF" => "افغانستان (Afghanistan)"
"AO" => "Angola"
"AI" => "Anguilla"
"AX" => "Åland (Åland Islands)"
"AL" => "Shqipëria (Albania)"
"AD" => "Andorra"
"AE" => "دولة الإمارات العربية المتحدة (United Arab Emirates)"
"AR" => "Argentina"
"AM" => "Հայաստան (Armenia)"
"AS" => "American Samoa"
"AQ" => "Antarctica"
"TF" => "Terres australes et antarctiques françaises (French Southern and Antarctic Lands)"
"AG" => "Antigua and Barbuda"
"AU" => "Australia"
"AT" => "Österreich (Austria)"
"AZ" => "Azərbaycan (Azerbaijan)"
"BI" => "Burundi"
"BE" => "Belgien (Belgium)"
"BJ" => "Bénin (Benin)"
"BF" => "Burkina Faso"
"BD" => "বাংলাদেশ (Bangladesh)"
"BG" => "България (Bulgaria)"
"BH" => "‏البحرين (Bahrain)"
"BS" => "Bahamas"
"BA" => "Bosna i Hercegovina (Bosnia and Herzegovina)"
"BL" => "Saint-Barthélemy (Saint Barthélemy)"
"SH" => "Saint Helena, Ascension and Tristan da Cunha"
"BY" => "Белару́сь (Belarus)"
"BZ" => "Belize"
"BM" => "Bermuda"
"BO" => "Wuliwya (Bolivia)"
"BQ" => "Caribisch Nederland (Caribbean Netherlands)"
"BR" => "Brasil (Brazil)"
"BB" => "Barbados"
"BN" => "Negara Brunei Darussalam (Brunei)"
"BT" => "འབྲུག་ཡུལ་ (Bhutan)"
"BV" => "Bouvetøya (Bouvet Island)"
"BW" => "Botswana"
"CF" => "République centrafricaine (Central African Republic)"
"CA" => "Canada"
"CC" => "Cocos (Keeling) Islands"
"CH" => "Suisse (Switzerland)"
"CL" => "Chile"
"CN" => "中国 (China)"
"CI" => "Côte d'Ivoire (Ivory Coast)"
"CM" => "Cameroon"
"CD" => "RD Congo (DR Congo)"
"CG" => "République du Congo (Republic of the Congo)"
"CK" => "Cook Islands"
"CO" => "Colombia"
"KM" => "القمر‎ (Comoros)"
"CV" => "Cabo Verde (Cape Verde)"
...

Generate a list of countries

$countries->all()->pluck('name.common')->toArray();

returns

[
    "Aruba",
    "Afghanistan",
    "Angola",
    "Anguilla",
    "Åland Islands",
    ....

Generate a list of currencies

$countries->all()->pluck('currencies')->toArray();

returns

[
  [
    "AWG",
  ],
  [
    "AFN",
  ],
  [
    "AOA",
  ],
  [
    "XCD",
  ],
  [
    "EUR",
  ],
  ....

Get the currency symbol

$countries->where('name.common', 'Brazil')->first()->hydrate('currencies')->currencies->BRL->units->major->symbol;

Generate a list of States

$countries->where('name.common', 'United States')
    ->first()
    ->hydrateStates()
    ->states
    ->sortBy('name')
    ->pluck('name', 'postal');

returns

[
    "AL": "Alabama",
    "AK": "Alaska",
    "AZ": "Arizona",
    "AR": "Arkansas",
    "CA": "California",
    ....
    ....

Hydrate and get a cities

$countries->where('cca3', 'FRA')
    ->first()
    ->hydrate('cities')
    ->cities
    ->paris
    ->timezone;

Should return

Europe/Paris

Get a countries currencies

$countries->where('name.common', 'United States')->first()->currencies;

returns

[{
    "alternativeSigns": [],
    "ISO4217Code": "USD",
    "ISO4217Number": "840",
    "sign": "$",
    "subunits": 100,
    "title": "U.S. dollar",
    ....

Get all currencies

$countries->currencies();

returns

[
    0 => "AED"
    1 => "AFN"
    2 => "ALL"
    3 => "AMD"
    4 => "ANG"
    5 => "AOA"
    6 => "ARS"
    7 => "AUD"
    8 => "AWG"
    9 => "AZN"
    10 => "BAM"
    ....

Get the timezone for a State

return $countries->where('name.common', 'United States')->first()->timezone->NC;

returns

America/New_York

Get all timezones for a country

$countries->where('name.common', 'Brazil')
  ->first()
  ->hydrateTimezones()
  ->timezones
  ->map(function ($timezone) {
      return $timezone->zone_name;
  })->values()
  ->unique()
  ->toArray();

Get all times for a timezone

return $countries->where('name.common', 'United States Virgin Islands')->first()->hydrate('timezones_times')->timezones->first()->times;

returns

"times" => [
    "abbreviation" => "LMT"
    "dst" => "0"
    "gmt_offset" => "-14764"
    "time_start" => "-1825098837"
    "zone_id" => "415"
    1 => [
        "abbreviation" => "AST"
        "dst" => "0"
        "gmt_offset" => "-14400"
        "time_start" => "-1825098836"
        "zone_id" => "415"
    ]
]

Flags

Countries provides many different flag sources, including SVG flags. This is how you use one of the available sources:

Install flag-icon

npm install --save-dev flag-icon-css

Import it to your project

@import '~flag-icon-css/sass/flag-icon.scss';

Use Countries to get the flag span

$unitedStatesFlag =
    $this->countries->where('cca3', 'USA')
    ->first()
    ->flag
    ->flag_icon;

Render it in your blade template

{!! $unitedStatesFlag !!}

Publishing assets

You can publish configuration by doing:

php artisan vendor:publish --provider=PragmaRX\\Countries\\ServiceProvider

Data

Sources

This package uses some other open source packages and, until we don't build a better documentation, you can find some more info about data on mledoze/countries and how to use it on this fantastic Laravel News article.

Please check the copyright section for a complete list of packages used by this one.

Updating

WARNING

No data files (JSON, images, icons...) on this project can be updated manually. We will close all pull requests requiring manual updates to those files will be closed, because the update script will delete them anyway.

If you find something wrong with data, you, please, have to ask the package managers (listed data sources and on the copyright section) to fix them, and then you can yourself run the update script to properly update them on this repository.

update.php

This package comes with the update.php script, which you MUST use to update the data files. It will download all info from all packages and automatically build the .json (and some others like .svg too). This is how you do it:

cd vendor/pragmarx/countries
composer install
php update.php

And wait for a very long time* (sometimes it looks like stuck but it's not) until it finishes rebuilding everything, then it's just a matter of staging, commit, push all regenerated files, and draft a new PR.

Cache

Since this data is not supposed to change, calls are automatically cached. If you want to change this behaviour, you can edit config/countries.php file once it's published.

Framework bridges

Sample files

Author

Antonio Carlos Ribeiro All contributors

Copyright

To build the countries database and relations, this package make use of those sources and packages:

License

Countries is licensed under the BSD 3-Clause License - see the LICENSE file for details

Contributing

Pull requests and issues are more than welcome.

Comments
  • Update pragmarx/coollection dependency to make it compatible with Laravel9

    Update pragmarx/coollection dependency to make it compatible with Laravel9

    Update pragmarx/coollection dependency. Also remove composer.lock and update travis config file.

    Motivation and context

    Laravel 9.x requires symfony/var-dumper ^6.0 and voku/portable-ascii ^2.0. This is part of some updates on multiple pragmarx packages which aren't compatible with Laravel9 yet, this helps fixing that.

    See

    • https://github.com/antonioribeiro/coollection/pull/14
    • https://github.com/antonioribeiro/ia-str/pull/5
    • https://github.com/antonioribeiro/ia-collection/pull/11
    • https://github.com/antonioribeiro/ia-arr/pull/4
    opened by asbiin 11
  • Problem on the laravel 5.5

    Problem on the laravel 5.5

    Sometimes when i do this request Countries::all()->pluck('translations.rus.common', 'postal') in my controller i see sometimes slow download page and sometimes see error about wait more 60 seconds. Help me. please

    opened by olegpy 9
  • Publishing Assets/Config

    Publishing Assets/Config

    Not sure but when running the publish command in the Readme, shows as publishing complete but nothing is published, even without specifying a tag nothing is published?

    opened by Braunson 9
  • france states list fix(earlier it was returning no state list for france country)

    france states list fix(earlier it was returning no state list for france country)

    I have worked on the France state list issue,where when fetching the state list for France it was returning no state list.Now after the fix we can get the states list of France. This issue was already raised as https://github.com/antonioribeiro/countries/issues/28

    opened by ramsyadav 8
  • Error found on Laravel 5.5

    Error found on Laravel 5.5

    Hi, is there any fix for this error? I really need this library for my Laravel application. 👍

    I've successfully installed the library in ubuntu 16.0 php 7.0 and laravel 5.5 and tested Country:all() and it returns this error Trait 'Tightenco\Collect\Support\Traits\Macroable' not found

    opened by ronjunevaldoz 7
  • Can't add package to Laravel 7

    Can't add package to Laravel 7

    I can't seem to add the package to Laravel 7. I'm not so good with the packages stuff, but the error that I seem to get is shown below.

    Problem 1 - Installation request for pragmarx/countries 0.7.0 -> satisfiable by pragmarx/countries[v0.7.0]. - Conclusion: remove symfony/var-dumper v5.0.5 - Conclusion: don't install symfony/var-dumper v5.0.5 - pragmarx/countries v0.7.0 requires pragmarx/coollection ^0.7 -> satisfiable by pragmarx/coollection[v0.7.0, v0.7.1].

    opened by mariusberget92 6
  • IlluminateExtracted\Support\Collection type error

    IlluminateExtracted\Support\Collection type error

    After upgrading to 0.5.0, I got this error:

    Type error: Argument 1 passed to Illuminate\Routing\Router::sortMiddleware() must be an instance of Illuminate\Support\Collection, instance of IlluminateExtracted\Support\Collection given, called in /home/ubuntu/leadingre_com/vendor/laravel/framework/src/Illuminate/Routing/Router.php on line 675

    Using Laravel 5.5

    opened by brians-code 6
  • Not Working on Laravel 5.8

    Not Working on Laravel 5.8

    Not installable on Laravel 5.8.

    Error Message:

    Problem 1 - Installation request for pragmarx/countries ^0.5.9 -> satisfiable by pragmarx/countries[v0.5.9]. - Conclusion: remove nesbot/carbon 2.14.2 - Conclusion: don't install nesbot/carbon 2.14.2 - pragmarx/countries v0.5.9 requires pragmarx/coollection ^0.6 -> satisfiable by pragmarx/coollection[v0.6.0, v0.6.1]. - pragmarx/coollection v0.6.0 requires pragmarx/ia-collection >=5.5.33 -> satisfiable by pragmarx/ia-collection[dev-master, v5.5.33, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.2, v5.6.3, v5.6.33, v5.6.38, v5.6.9, v5.7.5]. - pragmarx/coollection v0.6.1 requires pragmarx/ia-collection >=5.5.33 -> satisfiable by pragmarx/ia-collection[dev-master, v5.5.33, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.2, v5.6.3, v5.6.33, v5.6.38, v5.6.9, v5.7.5]. - pragmarx/ia-collection v5.5.33 requires nesbot/carbon ~1.20 -> satisfiable by nesbot/carbon[1.20.0, 1.21.0, 1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection dev-master requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection v5.6.0 requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection v5.6.1 requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection v5.6.10 requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection v5.6.11 requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection v5.6.12 requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection v5.6.2 requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection v5.6.3 requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection v5.6.33 requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection v5.6.38 requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection v5.6.9 requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - pragmarx/ia-collection v5.7.5 requires nesbot/carbon ~1.22 -> satisfiable by nesbot/carbon[1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2]. - Can only install one of: nesbot/carbon[1.26.3, 2.14.2]. - Can only install one of: nesbot/carbon[1.26.4, 2.14.2]. - Can only install one of: nesbot/carbon[1.27.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.28.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.29.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.29.1, 2.14.2]. - Can only install one of: nesbot/carbon[1.29.2, 2.14.2]. - Can only install one of: nesbot/carbon[1.30.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.31.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.31.1, 2.14.2]. - Can only install one of: nesbot/carbon[1.32.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.33.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.34.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.34.1, 2.14.2]. - Can only install one of: nesbot/carbon[1.34.2, 2.14.2]. - Can only install one of: nesbot/carbon[1.34.3, 2.14.2]. - Can only install one of: nesbot/carbon[1.34.4, 2.14.2]. - Can only install one of: nesbot/carbon[1.35.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.35.1, 2.14.2]. - Can only install one of: nesbot/carbon[1.36.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.36.1, 2.14.2]. - Can only install one of: nesbot/carbon[1.36.2, 2.14.2]. - Can only install one of: nesbot/carbon[1.20.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.21.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.22.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.22.1, 2.14.2]. - Can only install one of: nesbot/carbon[1.23.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.24.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.24.1, 2.14.2]. - Can only install one of: nesbot/carbon[1.24.2, 2.14.2]. - Can only install one of: nesbot/carbon[1.25.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.26.0, 2.14.2]. - Can only install one of: nesbot/carbon[1.26.1, 2.14.2]. - Can only install one of: nesbot/carbon[1.26.2, 2.14.2]. - Installation request for nesbot/carbon (locked at 2.14.2) -> satisfiable by nesbot/carbon[2.14.2].

    opened by charitablehumans 5
  • Adding States

    Adding States

    Hello @antonioribeiro ,

    Thanks for this awesome effort you have put to create this package. Kudos! I am trying to use this library in one of my projects and I have found that some data is currently missing.

    I want to help myself out and in process also help you and the entire community at large by filling in the blanks where ever possible.

    I have here a list of countries without states:

    ALA Åland Islands

    ATG Antigua and Barbuda

    BEL Belgium

    BIH Bosnia and Herzegovina

    ESH Western Sahara

    IRQ Iraq

    UNK Kosovo

    NOR Norway

    PNG Papua New Guinea

    PRT Portugal

    PSE Palestine

    SJM Svalbard and Jan Mayen

    SOM Somalia

    SRB Serbia

    SSD South Sudan

    SYR Syria

    UMI United States Minor Outlying Islands

    I have a database with me that has the list of states for the above countries. Could you please guide me as to what convention have you used to generate the state json data? What is the purpose of each field and how I can fill them out with proper and correct data?

    Looking forward for your response. Thanks a lot.

    Regards, Ajitem

    opened by asahasrabuddhe 5
  • Laravel 9 installation

    Laravel 9 installation

    Using version ^0.8.0 for pragmarx/countries ./composer.json has been updated Running composer update pragmarx/countries Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

    Problem 1 - Root composer.json requires pragmarx/countries ^0.8.0 -> satisfiable by pragmarx/countries[v0.8.0]. - pragmarx/countries v0.8.0 requires psr/simple-cache ^2.0 -> found psr/simple-cache[2.0.0, 2.x-dev] but it conflicts with your root composer.json require (^3.0).

    Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

    Installation failed, reverting ./composer.json and ./composer.lock to their original content.

    opened by roleosalaprojects 4
  • Update Mauritania currency to reflect change from MRO to MRU

    Update Mauritania currency to reflect change from MRO to MRU

    The ISO Currency Codes for the ouguiya were amended to MRU / 929 and the existing codes of MRO / 478 were retired as per ISO 4217 Amendment Number 165 dated 14 Dec 2017.

    opened by kerrinhardy 4
  •  No currencies found

    No currencies found

    I got this error while exuting php update.php. This is trace :

    Fatal error: Uncaught Exception: No currencies found in vendor/pragmarx/countries/src/data/third-party/world-currencies/package/src in /Users/osx/Documents/Reseau_social/scripts/push_event_services/vendor/pragmarx/countries/src/update/Currencies.php:47
    #0 vendor/pragmarx/countries/src/update/Updater.php(185): PragmaRX\Countries\Update\Currencies->update()
    #1 /Users/osx/Documents/Reseau_social/scripts/push_event_services/vendor/pragmarx/countries/update.php(17): PragmaRX\Countries\Update\Updater->update()
    #2 {main}
      thrown in vendor/pragmarx/countries/src/update/Currencies.php on line 47
    
    opened by mveabraham 0
  • Update to support Laravel 9

    Update to support Laravel 9

    Package currently has dependencies that conflict with Laravel 9, specifically pragmarx/coollection > pragmarx/ia-collection. There is already an open PR on that lib to support Laravel 9, but I've created this issue to track when we'd be able to update the dependency here.

    opened by mikewuu 7
  • Return psr/simple-cache v1 support

    Return psr/simple-cache v1 support

    Interface for psr/simple-cache has no breaking changes (with current implementation in mind) between v1 and v2: https://github.com/php-fig/simple-cache/compare/1.0.1...2.0.0 Most changes in v2 are related to strong typing and the current implementation of PragmaRX\Countries\Package\Services\Cache\Service will work with both versions of psr/simple-cache. Such versioning will allow to use this package with Laravel 8, which requires "psr/simple-cache": "^1.0"

    Actually, Laravel 9 requirements are "psr/simple-cache": "^1.0|^2.0|^3.0". And v3 just adds return types for methods: https://github.com/php-fig/simple-cache/compare/2.0.0...3.0.0 So, if you will NOT add types for methods parameters and will add return types, then such implementation of cache service will work with all current versions of psr/simple-cache

    opened by TaProhm 0
  • Imposible to use find

    Imposible to use find

    When we try to find a country by alternative names using sth like this:

    (new Countries())->first(fn ($item): bool => \in_array($country, $item->alt_spellings, true))

    We always get an error:

    Exception : Serialization of 'Closure' is not allowed

    It doesn't matter we use first() or filter(). Any option to use a function is not possible.

    opened by mgralikowski 2
  • Remove redundant `countries` prefix on config keys

    Remove redundant `countries` prefix on config keys

    Using https://github.com/antonioribeiro/countries-laravel, there is no way to enable or disable caching by overwriting the countries.php config. I found that this is due to redundant countries. prefixes in the Cache Service and Nette classes which lead to effectively reading from countries.countries.cache.enabled, thus ignoring any settings for cache.enabled.

    This is reproducible by publishing the config and changing any of the cache settings, for example the temp directory. All of the settings will be ignored, because the request to countries.countries.cache.enabled will return null, which is cast to false when returned from the Cache's enabled() method.

    This PR will remove the redundant countries prefixes and will presumably also fix https://github.com/antonioribeiro/countries-laravel/issues/17.

    opened by lupinitylabs 1
Releases(v0.6.2)
Owner
Antonio Carlos Ribeiro
Antonio Carlos Ribeiro
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

Christoph Kempen 695 Dec 30, 2022
Laravel package to convert currencies to/from Ghana Cedis(GHS).

Kudi About A Laravel package to convert currencies to/from Ghana Cedis(GHS). Installation composer require iamkarsoft\kudi Publishing config files php

Kofi Ramos 3 Jun 28, 2022
A simple Laravel Package to sort Countries, States and Cities

Laravel Location ▲ Introduction ?? This Package offers a simple way to get Countries, Cities and States that you may need for your Application, most e

Michael Okoh 197 Jan 1, 2023
Countries for Laravel

Countries for Laravel What does it gives you? This package has all sorts of information about countries: info items taxes 32 geometry maps 248 topolog

Antonio Carlos Ribeiro 140 Jan 5, 2023
Library for getting countries info from restcountries.com

librestcountries Library for getting countries info from restcountries.com Description Library for getting countries info from restcountries.com Getti

null 4 Sep 18, 2022
List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Laravel Lang 6.9k Jan 2, 2023
A Laravel 8 and Livewire 2 demo showing how to search and filter by tags, showing article and video counts for each tag (Polymorphic relationship)

Advanced search and filter with Laravel and Livewire A demo app using Laravel 8 and Livewire 2 showing how to implement a list of articles and tags, v

Sérgio Jardim 19 Aug 29, 2022
Laravel Podcast is Laravel 5.5 web app that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI and User Authentication.

Laravel Podcast is Laravel 5.5 web app that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI and

Jeremy Kenedy 35 Dec 19, 2022
Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS.

Nebula Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS. Nebula m

Nebula 228 Nov 11, 2022
Laravel package to generate and to validate a UUID according to the RFC 4122 standard. Only support for version 1, 3, 4 and 5 UUID are built-in.

Laravel Uuid Laravel package to generate and to validate a universally unique identifier (UUID) according to the RFC 4122 standard. Support for versio

Christoph Kempen 1.7k Dec 28, 2022
An opinionated support package for Laravel, that provides flexible and reusable helper methods and traits for commonly used functionality.

Support An opinionated support package for Laravel, that provides flexible and reusable helper methods and traits for commonly used functionality. Ins

Ian Olson 3 Apr 14, 2021
Laravel blade directives and php helpers for serverside rendered content, based on browser window size WITHOUT css. Requires Livewire and AlpineJS.

Laravel Livewire Window Size and Breakpoints Laravel blade directives and php helpers for server side rendered content, based on browser window size W

Tina Hammar 15 Oct 6, 2022
Sweetalert and Toaster notifications for Laravel livewire with support for tailwind and bootstrap.

Larabell Integrate livewire with sweetalert. Installation How to use Sweetalert Toast Available configuration Installation composer require simtabi/la

Simtabi 3 Jul 27, 2022
Invoices, Expenses and Tasks built with Laravel and Flutter

Invoice Ninja Hosted | Self-Hosted We're on Slack, join us at slack.invoiceninja.com or if you like StackOverflow Just make sure to add the invoice-ni

Invoice Ninja 6.8k Dec 26, 2022
Fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent Resources, Translatability, and Swagger.

Laravel Headless What about? This allows a fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent R

Julien SCHMITT 6 Dec 30, 2022
Laravel 5 Flash Notifications with icons and animations and with a timeout

Notify (Laravel) Notify alert boxes to the browser with sound and font awesome icons and give it a timeout to fly out. Works great to notify the user

Ben-Piet O'Callaghan 31 Oct 8, 2022
An issue tracking tool based on laravel+reactjs for small and medium-sized enterprises, open-source and free, similar to Jira.

ActionView English | 中文 An issue tracking tool based on php laravel-framework in back-end and reactjs+redux in front-end, it's similar to Jira. You co

null 1.7k Dec 23, 2022
Log executed Laravel SQL queries and their line number and more

A lightweight laravel package for logging executed SQL queries, line number and more

Md.Harun-Ur-Rashid 31 Dec 21, 2022
Create and manage A Domain Driven Design (DDD) in your Laravel app, simply and efficiently.

Create and manage A Domain Driven Design (DDD) in your Laravel app, simply and efficiently.

Lucas Nepomuceno 4 Jun 11, 2022