Emoji β
This section lets you easily grab country flags as emojis! It's a fun and simple way to display flags in your projects, perfect for user interfaces or anywhere you need a quick, compact flag representation.
This is perfect for adding a fun and universal representation of countries in your project, whether it's for visual displays, user interfaces, or any context where a compact flag representation is needed.
Flag Emoji By β
Returns the flag emoji based on the specified type.
->getFlagEmojiBy(string $type = 'img')
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiBy(); // Get Img
$country->getFlagEmojiBy('img'); // Get Img
$country->getFlagEmojiBy('utf8'); // Get Utf8
$country->getFlagEmojiBy('utf16'); // Get Utf16
$country->getFlagEmojiBy('uCode'); // Get uCode
$country->getFlagEmojiBy('hex'); // Get Hex
$country->getFlagEmojiBy('html'); // Get Html
$country->getFlagEmojiBy('css'); // Get Css
$country->getFlagEmojiBy('decimal'); // Get Decimal
$country->getFlagEmojiBy('shortcode'); // Get Short Code
Flag Emoji Image β
Returns the flag emoji
->getFlagEmoji()
$country = Country::inRandomOrder()->first();
// all functions are the same and return the same value
$country->getFlagEmoji();
$country->getFlagEmojiImage();
$country->getFlagEmojiImg();
Output Html β
Returns the flag emoji as an image wrapped in an HTML element.
->getFlagEmojiImgWithHtmlCode()
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiImgWithHtmlCode();
<span>πΎπͺ</span>
Flag Emoji UTF8 β
Returns the flag emoji in UTF-8 format.
->getFlagEmojiUtf8()
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiUtf8();
Output Html β
Returns the flag emoji in UTF-8 format wrapped in an HTML element.
->getFlagEmojiUtf8WithHtmlCode()
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiUtf8WithHtmlCode();
<span>π·πΊ</span>
Flag Emoji UTF16 β
Returns the flag emoji in UTF-16 format.
->getFlagEmojiUtf16()
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiUtf16();
Output Html β
Returns the flag emoji in UTF-16 format wrapped in an HTML element.
// Output Html and Css Code
->getFlagEmojiUtf16WithCode(string $divId = 'emoji-utf16')
// Output Html Code
->getFlagEmojiUtf16WithHtmlCode(string $divId = 'emoji-utf16')
// Output Script Code
->getFlagEmojiUtf16WithScriptCode(string $divId = 'emoji-utf16', bool $withTag = false)
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiUtf16WithCode();
<span id="emoji-utf16"></span>
<script>
document.getElementById("emoji-utf16").innerText = "\uD83C\uDDE7\uD83C\uDDF7";
</script>
Output Html and JavaScript β
Returns the flag emoji in UTF-16 format wrapped in an HTML element and includes JavaScript to update the HTML element.
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiUtf16WithHtmlCode();
<span id="emoji-utf16"></span>
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiUtf16WithScriptCode();
<script>
document.getElementById("emoji-utf16").innerText = "\uD83C\uDDE7\uD83C\uDDF7";
</script>
document.getElementById("emoji-utf16").innerText = "\uD83C\uDDE7\uD83C\uDDF7";
Flag Emoji Unicode Code β
Returns the flag emoji as a Unicode code point.
Flag Emoji Hexadecimal β
Returns the flag emoji as a hexadecimal representation.
Output Html β
Returns the flag emoji as a hexadecimal representation wrapped in an HTML element.
Flag Emoji HTML Entity β
Returns the flag emoji as an HTML entity.
Output Html β
Returns the flag emoji as an HTML entity wrapped in an HTML element.
Flag Emoji CSS β
Returns the flag emoji as a CSS value.
Output CSS and Html β
Returns the flag emoji as a CSS value and includes an HTML element for styling the flag emoji.
Flag Emoji Decimal β
Returns the flag emoji as a decimal representation.
Output Html β
Returns the flag emoji as a decimal representation wrapped in an HTML element.
Flag Emoji Shortcode β
Returns the flag emoji as a shortcode.