mobbi-dev / minicountryflag
Small PHP class to get country flags as emojis based on country codes (ISO 3166-1 alpha-2).
v1.0.0
2025-07-04 09:25 UTC
Requires
- php: >=7.4
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