Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Countries Laravel Package

drnd-dev/laravel-countries

View on GitHub
Deep Wiki
Context7

Facade

The FlagEmoji facade is designed to enable you to interact with flag emoji attributes independently from the broader country data.

It uses a collection of flag emoji attributes, allowing you to retrieve, manipulate, and access specific emoji information in various formats (e.g., UTF-8, CSS, hexadecimal, etc.).

This is particularly useful for displaying flags or performing operations on flag emojis without dealing with the entire country dataset.

::: tip And all the methods you can see on the Emoji page :::

Usage

You can easily initialize the FlagEmoji facade by passing a single flag's attributes or a collection of them:

use Lwwcas\LaravelCountries\Facades\FlagEmoji;

new FlagEmoji([
    "css" => "\\1F1F5\\1F1F9",
    "hex" => "🇵🇹",
    "img" => "🇵🇹",
    "html" => "🇵🇹",
    "utf8" => "🇵🇹",
    "uCode" => "U+1F1F5 U+1F1F9",
    "utf16" => "\\uD83C\\uDDF5\\uD83C\\uDDF9",
    "decimal" => "🇵🇹",
    "shortcode" => ":flag-pt:"
]);

You can also pass a collection of flag attributes, which can be generated through a query result:

use Lwwcas\LaravelCountries\Facades\FlagEmoji;

$response = $country->withNamesSlugsAndFlags()->pluck('flag_emoji', 'uid');
return (new FlagEmoji($result));

Method Listing

Whether you're working with collections or individual flags, these methods ensure easy access and flexibility in handling flag emoji data.

Get

Retrieves a specific flag emoji attribute by key. If no key is provided, it returns all flag emoji attributes as a collection.

->get($flagKey = null)
$flagEmoji = new FlagEmoji($attributes);
$flagEmoji->get(); // Returns all attributes
$flagEmoji->get('css'); // Returns the CSS representation of the emoji

First

Returns the first flag emoji attribute from the collection.

->first()
$firstFlag = $flagEmoji->first();

Last

Retrieves the last flag emoji attribute from the collection.

->last()
$lastFlag = $flagEmoji->last();

Key

Returns the key of the current flag emoji.

->key()
$keyFlag = $flagEmoji->key();

keys

Returns a collection of the keys of all flag emoji attributes.

->keys()
$keysFlag = $flagEmoji->keys();
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata