mobbi-dev/minicountryflag

Small PHP class to get country flags as emojis based on country codes (ISO 3166-1 alpha-2).

Maintainers

Package info

github.com/mobbi-dev/MiniCountryFlag

pkg:composer/mobbi-dev/minicountryflag

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2025-07-04 09:25 UTC

This package is auto-updated.

Last update: 2026-04-04 11:48:50 UTC


README

MiniCountryFlag is a tiny PHP class that converts ISO 3166-1 alpha-2 country codes (like FI, US, JP) into flag emojis (🇫🇮 🇺🇸 🇯🇵).

Perfect for small projects, websites, or any application that needs to display country flags from ISO codes in a lightweight way.

🚀 Features

  • Converts valid 2-letter country codes (e.g. FI, US, JP) to flag emojis (🇫🇮 🇺🇸 🇯🇵)
  • Validates input (throws exception on invalid codes)
  • Lightweight

📦 Installation

Using Composer:

composer require mobbi-dev/minicountryflag

🔧 Usage

use MiniCountryFlag\MiniCountryFlag;

$flag = new MiniCountryFlag('fi');

echo $flag->getEmoji(); // 🇫🇮
echo $flag->getName(); // Finland
echo $flag->getFlagImageUrl(); // https://flagcdn.com/24x18/fi.png