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.
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
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();
Returns the flag emoji as an image wrapped in an HTML element.
->getFlagEmojiImgWithHtmlCode()
::: code-group
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiImgWithHtmlCode();
<span>πΎπͺ</span>
:::
Returns the flag emoji in UTF-8 format.
->getFlagEmojiUtf8()
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiUtf8();
Returns the flag emoji in UTF-8 format wrapped in an HTML element.
->getFlagEmojiUtf8WithHtmlCode()
::: code-group
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiUtf8WithHtmlCode();
<span>π·πΊ</span>
:::
Returns the flag emoji in UTF-16 format.
->getFlagEmojiUtf16()
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiUtf16();
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)
::: code-group
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiUtf16WithCode();
<span id="emoji-utf16"></span>
<script>
document.getElementById("emoji-utf16").innerText = "\uD83C\uDDE7\uD83C\uDDF7";
</script>
:::
Returns the flag emoji in UTF-16 format wrapped in an HTML element and includes JavaScript to update the HTML element.
::: code-group
$country = Country::inRandomOrder()->first();
$country->getFlagEmojiUtf16WithHtmlCode();
<span id="emoji-utf16"></span>
:::
::: code-group
$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";
:::
Returns the flag emoji as a Unicode code point.
Returns the flag emoji as a hexadecimal representation.
Returns the flag emoji as a hexadecimal representation wrapped in an HTML element.
Returns the flag emoji as an HTML entity.
Returns the flag emoji as an HTML entity wrapped in an HTML element.
Returns the flag emoji as a CSS value.
Returns the flag emoji as a CSS value and includes an HTML element for styling the flag emoji.
Returns the flag emoji as a decimal representation.
Returns the flag emoji as a decimal representation wrapped in an HTML element.
Returns the flag emoji as a shortcode.
How can I help you explore Laravel packages today?