PHPackages                             marshmallow/dataset-country - 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. marshmallow/dataset-country

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

marshmallow/dataset-country
===========================

This dataset contains all the countries in the world. They are translateable in different languages. It is also possible to get the flag from said countries. The model is extendable so you can extend and overide all functionality if needed.

v1.3.0(9mo ago)18.8k↓29.6%[1 PRs](https://github.com/marshmallow-packages/dataset-country/pulls)3MITPHPPHP ^7.4|^8.0CI passing

Since Apr 6Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/marshmallow-packages/dataset-country)[ Packagist](https://packagist.org/packages/marshmallow/dataset-country)[ Docs](https://github.com/Marshmallow-Development/)[ RSS](/packages/marshmallow-dataset-country/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (13)Used By (3)

[![alt text](https://camo.githubusercontent.com/329958cb02b7bee461fd9dcae7a0a3a34e6595669116ff441ad5ef9e77bc511c/68747470733a2f2f63646e2e6d617273686d616c6c6f772d6f66666963652e636f6d2f6d656469612f696d616765732f6c6f676f2f6d617273686d616c6c6f772e7472616e73706172656e742e7265642e706e67 "marshmallow.")](https://camo.githubusercontent.com/329958cb02b7bee461fd9dcae7a0a3a34e6595669116ff441ad5ef9e77bc511c/68747470733a2f2f63646e2e6d617273686d616c6c6f772d6f66666963652e636f6d2f6d656469612f696d616765732f6c6f676f2f6d617273686d616c6c6f772e7472616e73706172656e742e7265642e706e67)

Marshmallow Dataset Country
===========================

[](#marshmallow-dataset-country)

This dataset contains all the countries in the world. They are translateable in different languages. It is also possible to get the flag from said countries. The model is extendable so you can extend and overide all functionality if needed.

### Installatie

[](#installatie)

```
composer require marshmallow/dataset-country

```

Seed the table
==============

[](#seed-the-table)

Run `php artisan db:seed --class=Marshmallow\\Datasets\\Country\\Seeders\\CountrySeeder` to seed the country table.

Nova
====

[](#nova)

Are you using Nova? We have a command for you to generate the Nova Resource. Run `php artisan marshmallow:resource Country Datasets\\Country` and countries will be available to you in Nova. We hide this resource by default in the Nova navigation. If you wish to have it available in the navigation, add `public static $displayInNavigation = true;` to `app/Nova/Country.php`.

Methods
=======

[](#methods)

- Get the locale version of a country with `$country->getNameLocale()`.

Flags
=====

[](#flags)

You can get the flag of a country with `$country->flag`. If you wish to specify the size of the flag image, you can use `$country->flag('16')`. The available sizes are 16x16, 24x24, 32x32, 48x48, 64x64 and 128x128. To make use of the flags you will need to publish the flags to your local project by running `php artisan vendor:publish --provider="Marshmallow\Datasets\Country\ServiceProvider" --tag=public --force`.

Traits
======

[](#traits)

Add the `HasCountry` trait on your models that have a country. This will set up the relationship and possibly give you extra methods in the future.

Tests during development
------------------------

[](#tests-during-development)

`php artisan test packages/datasets/country`

- Test that the seeder works
- Check the translater works
- Check it is slugged
- Check name is unique
- Check slug is unique
- Check Alpha2 is unique
- Check Alpha3 is unique
- Check you can get the flag with magic -&gt;flag.
- Check you can get the flag with method flag().

Translated
----------

[](#translated)

- Arabic (ar)
- Chinese (cn)
- Czech (cs)
- Danish (da)
- German (de)
- Greek (el)
- English (en)
- Spanish (es)
- Estonian (et)
- French (fr)
- Hungarian (hu)
- Italian (it)
- Japanese (ja)
- Lithuanian (lt)
- Dutch (nl)
- Norwegian (no)
- Polish (pl)
- Portuguese (pt)
- Romanian (ro)
- Russian (ru)
- Slovak (sk)
- Thai (th)
- Ukrainian (uk)

---

Copyright (c) 2020 marshmallow

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance65

Regular maintenance activity

Popularity24

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% 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 ~195 days

Recently: every ~448 days

Total

11

Last Release

277d ago

PHP version history (2 changes)v1.0.0PHP ^7.4

v1.2.1PHP ^7.4|^8.0

### Community

Maintainers

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

---

Top Contributors

[![stefvanesch](https://avatars.githubusercontent.com/u/46725619?v=4)](https://github.com/stefvanesch "stefvanesch (32 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")

---

Tags

marshmallow

### Embed Badge

![Health badge](/badges/marshmallow-dataset-country/health.svg)

```
[![Health](https://phpackages.com/badges/marshmallow-dataset-country/health.svg)](https://phpackages.com/packages/marshmallow-dataset-country)
```

PHPackages © 2026

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