PHPackages                             anandpilania/laravel-country.io - 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. [Database &amp; ORM](/categories/database)
4. /
5. anandpilania/laravel-country.io

ActiveLibrary[Database &amp; ORM](/categories/database)

anandpilania/laravel-country.io
===============================

Country.io database for laravel

v2.1.1(1y ago)012MITPHP

Since Dec 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AnandPilania/laravel-country.io)[ Packagist](https://packagist.org/packages/anandpilania/laravel-country.io)[ RSS](/packages/anandpilania-laravel-countryio/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (12)Used By (0)

anandpilania/laravel-country.io
===============================

[](#anandpilanialaravel-countryio)

[![Hits](https://camo.githubusercontent.com/7ee35fdae05252492310059d66f4da00a1456a376fa7b30391bc31fe176032bd/68747470733a2f2f686974732e736565796f756661726d2e636f6d2f6170692f636f756e742f696e63722f62616467652e7376673f75726c3d68747470732533412532462532466769746875622e636f6d253246416e616e6450696c616e69612532466c61726176656c2d636f756e7472792e696f26636f756e745f62673d253233464633383633267469746c655f62673d253233324333453530267469746c653d6869747326656467655f666c61743d66616c7365)](https://hits.seeyoufarm.com)

### UPDATE (v2.0.4)

[](#update-v204)

- Your own `migration` name,
- Set model from config,
- Performance improvement.
- v2.0.3

    - KEEP needed columns only,
    - direct control via `config` file.

`Laravel-Country.io` - `artisan` based package that can fetch countries list with details aka:

- Code
- Continent
- Capital
- GDP
- Population
- ISO2/3
- Language
- Population

and more directly from [Country.io](http://country.io) and store it directly into `file|db`.

### Installation

[](#installation)

```
$ composer require anandpilania/laravel-country.io
```

#### FIRST STEP

[](#first-step)

```
$ php artisan vendor:publish --tag=countryio-config
```

and configure `config` according to your need.

#### OPTIONAL STEP

[](#optional-step)

```
$ php artisan vendor:publish --tag=countryio-migration
```

#### BEFORE USING

[](#before-using)

Configure/adjust `countryio` config file according to your need

```
  - table_name          - table name for storing in DB,
  - model               - Define your own `Model` class [\App\Models\Country::class],
  - cols_type           - `plain|json` [`plain` aka `continent`, `population_total` AND `json` aka `geography.continent`, `population.total`],
  - cols                - `cols_type` free columns,
  - cols_plain|json     - `cols_type` based columns,
  - file                - If not DB, than location of file (`--to=file|db` option of `countryio` artisan command)
```

#### How to use

[](#how-to-use)

First take a look of supported `options`

```
$ php artisan help countryio
```

```
--to      : file OR db
--offline : save fetched files to `storage/country` dir
--clean   : clean everything after setup
--fresh   : Fresh install (for `db` use only, truncates)
--silent  : silent work
```

**NOTE: Default location is `storage/app/countryio.json`**

So, if you want to `file` list only (default): First publish the `config` file

```
$ php artisan vendor:publish --tag="countryio-config"
```

then, change the location: `config/countryio.php`

```
'file' => storage_path('app/...');
```

and fire:

```
php artisan countryio
```

##### FOR `db`:

[](#for-db)

`anandpilania/laravel-country.io` contains Country `migration` &amp; `model`

```
php artisan countryio --to=db
```

will create `migration table` (based on `countryio` config) &amp; `CountryIO` model (DEFAULT, if not set in config file) &amp; update the database directly.

**Why not using `migration publish`: beacuse if your application already have migration/model for `country` then ...**

### Todos

[](#todos)

- App use `file` based `table`
- Flags

#### Play with `artisan`:

[](#play-with-artisan)

Add to `routes/console.php`:

```
Artisan::command('countries', function () {
    $count = $this->ask('How many entries?');
    $model = config('countryio.model', \App\Models\CountryIO::class);

    if(!class_exists($model)) {
        $this->error($model . ' not exists!');
    }

    foreach ((new $model)->take($count ?? 10)->get() as $c) {
        $output = '';
        foreach (array_merge(config('countryio.cols', []), config('countryio.cols_' . config('countryio.cols_type', 'plain'), [])) as $col => $enabled) {
            if ($enabled) {
                $output .= $c->{$col} . ', ';
            }
        }

        $this->comment($output);
    }
})->purpose('Check CountryIO');
```

and `php artisan countries` :)

License
-------

[](#license)

MIT

**Free Software, Hell Yeah!**

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance44

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~154 days

Recently: every ~381 days

Total

11

Last Release

436d ago

Major Versions

v1.0.2 → v2.0.02020-12-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1209e551536746ac78a8a4b7f5a2cc13f776629484c441edc5d3f1a50edbea0?d=identicon)[AnandPilania](/maintainers/AnandPilania)

---

Top Contributors

[![AnandPilania](https://avatars.githubusercontent.com/u/14306728?v=4)](https://github.com/AnandPilania "AnandPilania (18 commits)")

### Embed Badge

![Health badge](/badges/anandpilania-laravel-countryio/health.svg)

```
[![Health](https://phpackages.com/badges/anandpilania-laravel-countryio/health.svg)](https://phpackages.com/packages/anandpilania-laravel-countryio)
```

###  Alternatives

[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[ryangjchandler/orbit

A flat-file database driver for Eloquent.

922256.2k5](/packages/ryangjchandler-orbit)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
