Download the PHP package pragmarx/countries without Composer

On this page you can find all versions of the php package pragmarx/countries. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

Please rate this library. Is it a good library?

All versions of countries with dependencies

Informations about the package countries


Latest Stable Version 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:



Use Composer to install it:


Should both return

Overloading the default configuration:



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:

To get a json you:

Filter by keys and values:

Will find Brazil by its common name, which is a

Or alternatively you can filter like this

And, you can go deepeer

Or search by the country top level domain

To get

And use things like pluck

To get

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

Should give

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

Should return



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

Those are some of the hydratable properties:

Extra where rules

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

You can of course access them like other properties


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

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


Some other examples from Laravel News and some other contributors

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

Should give you 267 (or so) countries like:

Generate a list of countries


Generate a list of currencies


Get the currency symbol

Generate a list of States


Hydrate and get a cities

Should return

Get a countries currencies


Get all currencies


Get the timezone for a State


Get all timezones for a country

Get all times for a timezone



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

Install flag-icon

Import it to your project

Use Countries to get the flag span

Render it in your blade template

Publishing assets

You can publish configuration by doing:



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.



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.


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:

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.


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


Antonio Carlos Ribeiro All contributors


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


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


Pull requests and issues are more than welcome.

Requires php Version >=7.0
pragmarx/coollection Version >=0.5
psr/simple-cache Version ^1.0
nette/caching Version ^2.5|^3.0
colinodell/json5 Version ^1.0|^2.0

The package pragmarx/countries contains the following files

Loading the files please wait ....