PHPackages                             nathandunn/laravel-countries - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nathandunn/laravel-countries

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nathandunn/laravel-countries
============================

v3.1.0(1y ago)0831[1 issues](https://github.com/nthndnn/laravel-countries/issues)MITPHPPHP &gt;=8.1

Since Feb 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nthndnn/laravel-countries)[ Packagist](https://packagist.org/packages/nathandunn/laravel-countries)[ RSS](/packages/nathandunn-laravel-countries/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)Dependencies (16)Versions (6)Used By (0)

Laravel Countries 🌎
===================

[](#laravel-countries-)

[![Packagist](https://camo.githubusercontent.com/8f3192c26c75ca90d47b598c34a5d65244f82089d360bff508db771bfb3ee02d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e617468616e64756e6e2f6c61726176656c2d636f756e74726965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nathandunn/laravel-countries)[![GitHub Workflow Status (master branch)](https://camo.githubusercontent.com/fdc3e6df643549bddc0ca183e023e9e6b26db9c43902fde13afd383d44cc3572/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6e74686e646e6e2f6c61726176656c2d636f756e74726965732f72756e2d74657374732f6d6173746572)](https://github.com/nthndnn/laravel-countries/actions/workflows/run-tests.yml?query=branch%3Amaster)[![Code Climate](https://camo.githubusercontent.com/41d3e266ba15439a8c3e89cb3d0552f7298010b14bd1b0541f9e0cae16fb509a/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f6d61696e7461696e6162696c6974792f6e74686e646e6e2f6c61726176656c2d636f756e74726965732e7376673f7374796c653d666c61742d737175617265)](https://codeclimate.com/github/nthndnn/laravel-countries)[![Codecov](https://camo.githubusercontent.com/88e0d50320ed030bf98e56e46a4230838733534699f35d3187adb44e57132375/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f6e74686e646e6e2f6c61726176656c2d636f756e74726965733f746f6b656e3d5946394254534834474e267374796c653d666c61742d737175617265)](https://app.codecov.io/gh/nthndnn/laravel-countries)[![StyleCI](https://camo.githubusercontent.com/ef8e2c55ce04b77460dfb5b5eae9474e82a5bdd6e0134f6370d97b80a15fd003/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3432343937383731302f736869656c64)](https://github.styleci.io/repos/424978710)

Laravel Countries provides database migrations and syncing capabilities in order to sync continents, currencies and currencies. The package uses the [REST Countries](https://restcountries.com/) API to maintain an up-to-date list of countries. This is in contrast to a lot of existing libraries, which rely on data stored in the repository and often becomes out-of-date.

Installation
------------

[](#installation)

You can install the package via [Composer](https://getcomposer.org/):

```
composer require nathandunn/laravel-countries
```

Once the package has been installed, run Laravel's migration command to create the base tables.

```
php artisan migrate
```

Syncing countries
-----------------

[](#syncing-countries)

### Console command

[](#console-command)

The primary method of syncing companies is by running the following command:

```
php artisan countries:sync
```

This will fetch and sync data from the API.

### Seeder

[](#seeder)

You may find you'd like to add syncing countries as part of your development/staging environment. You may add `NathanDunn\Countries\Database\Seeders\CountrySeeder` to your `DatabaseSeeder`.

```
