Skip to content

Single List

This collection of methods always returns a Laravel collection with a list of items based on the method used. These methods are helpful to quickly retrieve specific fields from the country data.

Only ID

Returns a list of country IDs.

php
Country::getList()->onlyId();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => 248
    1 => 260
    2 => 251
    3 => 305
    4 => 256
    5 => 246
    6 => 253
    7 => 250
    8 => 254
    9 => 249
    ...

Only UID

Returns a list of country UIDs.

php
Country::getList()->onlyUid();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "01J9VCYESCNW4EWFYB9ENTNCN2"
    1 => "01J9VCYEYFYD063XMYZR653QEB"
    2 => "01J9VCYET590JW3HK27CHBXYPH"
    3 => "01J9VCYFDSTZ8F5VSDB2XFHGQJ"
    4 => "01J9VCYEX2RXVM2XNS61VZ11KR"
    5 => "01J9VCYERPV0Q73J9MA9TBEKJ6"
    6 => "01J9VCYETMYK5GYHBD84539V1W"
    7 => "01J9VCYESY8K411YFR48P7JPP1"
    8 => "01J9VCYEV40SY7GX48CKEK4N05"
    9 => "01J9VCYESPTRKZR0ZDH10EWX56"
    ...

Only Name

Returns a list of country names

php
Country::getList()->onlyName();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "Afghanistan"
    1 => "Åland Islands"
    2 => "Albania"
    3 => "Algeria"
    4 => "American Samoa"
    5 => "Andorra"
    6 => "Angola"
    7 => "Anguilla"
    8 => "Antarctica"
    9 => "Antigua and Barbuda"
    ...

Only Official Names

Returns a list of official country names.

php
Country::getList()->onlyOfficialName();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "Islamic Emirate of Afghanistan"
    1 => "Åland Islands"
    2 => "Republic of Albania"
    3 => "People's Democratic Republic of Algeria"
    4 => "American Samoa"
    5 => "Principality of Andorra"
    6 => "Republic of Angola"
    7 => "Anguilla"
    8 => "Antarctica"
    9 => "Antigua and Barbuda"
    ...

Only Iso

Returns a list of ISO 3166-1 alpha-2 codes.

php
Country::getList()->onlyIso();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "AF"
    1 => "AX"
    2 => "AL"
    3 => "DZ"
    4 => "AS"
    5 => "AD"
    6 => "AO"
    7 => "AI"
    8 => "AQ"
    9 => "AG"
    ...

Only Alpha 2

Returns a list of ISO 3166-1 alpha-2 codes.

php
Country::getList()->onlyAlpha2();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "AF"
    1 => "AX"
    2 => "AL"
    3 => "DZ"
    4 => "AS"
    5 => "AD"
    6 => "AO"
    7 => "AI"
    8 => "AQ"
    9 => "AG"
    ...

Only Alpha 3

Returns a list of ISO 3166-1 alpha-3 codes.

php
Country::getList()->onlyAlpha3();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "AFG"
    1 => "ALA"
    2 => "ALB"
    3 => "DZA"
    4 => "ASM"
    5 => "AND"
    6 => "AGO"
    7 => "AIA"
    8 => "ATA"
    9 => "ATG"
    ...

Flags

The flags method (onlyFlag() and onlyEmoji()) returns a Facade called FlagEmoji, which can be used to work with the collection of flag emojis.

TIP

Read more about FlagEmoji Facade

Only Flag

Returns a list of country flag emojis.

php
Country::getList()->onlyFlag();
php
Lwwcas\LaravelCountries\Facades\FlagEmoji {
   flag_emoji: null
   on_data: array:245 [
    0 => Lwwcas\LaravelCountries\Facades\FlagEmoji {#527 ▼
      flag_emoji: array:9 [
        "css" => "\1F1E6\1F1EB"
        "hex" => "🇦🇫"
        "img" => "🇦🇫"
        "html" => "🇦🇫"
        "utf8" => "🇦🇫"
        "uCode" => "U+1F1E6 U+1F1EB"
        "utf16" => "\uD83C\uDDE6\uD83C\uDDEB"
        "decimal" => "🇦🇫"
        "shortcode" => ":flag-af:"
      ]
      on_data: null
      key: null
      attributes: array:9 []
    }
    1 => Lwwcas\LaravelCountries\Facades\FlagEmoji {#526 ▼
      flag_emoji: array:9 [
        "css" => "\1F1E6\1F1FD"
        "hex" => "🇦🇽"
        "img" => "🇦🇽"
        "html" => "🇦🇽"
        "utf8" => "🇦🇽"
        "uCode" => "U+1F1E6 U+1F1FD"
        "utf16" => "\uD83C\uDDE6\uD83C\uDDFD"
        "decimal" => "🇦🇽"
        "shortcode" => ":flag-ax:"
      ]
      on_data: null
      key: null
      attributes: array:9 []
    }
    2 => Lwwcas\LaravelCountries\Facades\FlagEmoji { 
      flag_emoji: array:9 [
        "css" => "\1F1E6\1F1F1"
        "hex" => "🇦🇱"
        "img" => "🇦🇱"
        "html" => "🇦🇱"
        "utf8" => "🇦🇱"
        "uCode" => "U+1F1E6 U+1F1F1"
        "utf16" => "\uD83C\uDDE6\uD83C\uDDF1"
        "decimal" => "🇦🇱"
        "shortcode" => ":flag-al:"
      ]
      on_data: null
      key: null
      attributes: array:9 []
    }
    ...

Only Emoji

Returns a list of country flag emojis.

php
Country::getList()->onlyEmoji();
php
Lwwcas\LaravelCountries\Facades\FlagEmoji {
   flag_emoji: null
   on_data: array:245 [
    0 => Lwwcas\LaravelCountries\Facades\FlagEmoji {#527 ▼
      flag_emoji: array:9 [
        "css" => "\1F1E6\1F1EB"
        "hex" => "🇦🇫"
        "img" => "🇦🇫"
        "html" => "🇦🇫"
        "utf8" => "🇦🇫"
        "uCode" => "U+1F1E6 U+1F1EB"
        "utf16" => "\uD83C\uDDE6\uD83C\uDDEB"
        "decimal" => "🇦🇫"
        "shortcode" => ":flag-af:"
      ]
      on_data: null
      key: null
      attributes: array:9 []
    }
    1 => Lwwcas\LaravelCountries\Facades\FlagEmoji {#526 ▼
      flag_emoji: array:9 [
        "css" => "\1F1E6\1F1FD"
        "hex" => "🇦🇽"
        "img" => "🇦🇽"
        "html" => "🇦🇽"
        "utf8" => "🇦🇽"
        "uCode" => "U+1F1E6 U+1F1FD"
        "utf16" => "\uD83C\uDDE6\uD83C\uDDFD"
        "decimal" => "🇦🇽"
        "shortcode" => ":flag-ax:"
      ]
      on_data: null
      key: null
      attributes: array:9 []
    }
    2 => Lwwcas\LaravelCountries\Facades\FlagEmoji { 
      flag_emoji: array:9 [
        "css" => "\1F1E6\1F1F1"
        "hex" => "🇦🇱"
        "img" => "🇦🇱"
        "html" => "🇦🇱"
        "utf8" => "🇦🇱"
        "uCode" => "U+1F1E6 U+1F1F1"
        "utf16" => "\uD83C\uDDE6\uD83C\uDDF1"
        "decimal" => "🇦🇱"
        "shortcode" => ":flag-al:"
      ]
      on_data: null
      key: null
      attributes: array:9 []
    }
    ...

Only Emoji in Img

Returns a list of emojis img.

php
Country::getList()->onlyEmojiInImg();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "🇦🇫"
    1 => "🇦🇽"
    2 => "🇦🇱"
    3 => "🇩🇿"
    4 => "🇦🇸"
    5 => "🇦🇩"
    6 => "🇦🇴"
    7 => "🇦🇮"
    8 => "🇦🇶"
    9 => "🇦🇬"
    ...

Only Emoji in UTF8

Returns a list of emojis UTF8.

php
Country::getList()->onlyEmojiInUtf8();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "🇦🇫"
    1 => "🇦🇽"
    2 => "🇦🇱"
    3 => "🇩🇿"
    4 => "🇦🇸"
    5 => "🇦🇩"
    6 => "🇦🇴"
    7 => "🇦🇮"
    8 => "🇦🇶"
    9 => "🇦🇬"
    ...

Only Emoji in UTF16

Returns a list of emojis UTF16.

php
Country::getList()->onlyEmojiInUtf16();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "\uD83C\uDDE6\uD83C\uDDEB"
    1 => "\uD83C\uDDE6\uD83C\uDDFD"
    2 => "\uD83C\uDDE6\uD83C\uDDF1"
    3 => "\uD83C\uDDE9\uD83C\uDDFF"
    4 => "\uD83C\uDDE6\uD83C\uDDF8"
    5 => "\uD83C\uDDE6\uD83C\uDDE9"
    6 => "\uD83C\uDDE6\uD83C\uDDF4"
    7 => "\uD83C\uDDE6\uD83C\uDDEE"
    8 => "\uD83C\uDDE6\uD83C\uDDF6"
    9 => "\uD83C\uDDE6\uD83C\uDDEC"
    ...

Only Emoji in HTML

Returns a list of emojis html.

php
Country::getList()->onlyEmojiInHtml();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "🇦🇫"
    1 => "🇦🇽"
    2 => "🇦🇱"
    3 => "🇩🇿"
    4 => "🇦🇸"
    5 => "🇦🇩"
    6 => "🇦🇴"
    7 => "🇦🇮"
    8 => "🇦🇶"
    9 => "🇦🇬"
    ...

Only Emoji in CSS

Returns a list of emojis css.

php
Country::getList()->onlyEmojiInCss();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "\1F1E6\1F1EB"
    1 => "\1F1E6\1F1FD"
    2 => "\1F1E6\1F1F1"
    3 => "\1F1E9\1F1FF"
    4 => "\1F1E6\1F1F8"
    5 => "\1F1E6\1F1E9"
    6 => "\1F1E6\1F1F4"
    7 => "\1F1E6\1F1EE"
    8 => "\1F1E6\1F1F6"
    9 => "\1F1E6\1F1EC"
    ...

Only Emoji in Hex

Returns a list of emojis hex.

php
Country::getList()->onlyEmojiInHex();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "🇦🇫"
    1 => "🇦🇽"
    2 => "🇦🇱"
    3 => "🇩🇿"
    4 => "🇦🇸"
    5 => "🇦🇩"
    6 => "🇦🇴"
    7 => "🇦🇮"
    8 => "🇦🇶"
    9 => "🇦🇬"
    ...

Only Emoji in uCode

Returns a list of emojis uCode.

php
Country::getList()->onlyEmojiInUCode();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "U+1F1E6 U+1F1EB"
    1 => "U+1F1E6 U+1F1FD"
    2 => "U+1F1E6 U+1F1F1"
    3 => "U+1F1E9 U+1F1FF"
    4 => "U+1F1E6 U+1F1F8"
    5 => "U+1F1E6 U+1F1E9"
    6 => "U+1F1E6 U+1F1F4"
    7 => "U+1F1E6 U+1F1EE"
    8 => "U+1F1E6 U+1F1F6"
    9 => "U+1F1E6 U+1F1EC"
    ...

Only Emoji in Decimal

Returns a list of emojis decimal.

php
Country::getList()->onlyEmojiInDecimal();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => "🇦🇫"
    1 => "🇦🇽"
    2 => "🇦🇱"
    3 => "🇩🇿"
    4 => "🇦🇸"
    5 => "🇦🇩"
    6 => "🇦🇴"
    7 => "🇦🇮"
    8 => "🇦🇶"
    9 => "🇦🇬"
    ...

Only Emoji in short code

Returns a list of emojis shortcode.

php
Country::getList()->onlyEmojiInShortCode();
php
Illuminate\Support\Collection {
  items: array:245 [
    0 => ":flag-af:"
    1 => ":flag-ax:"
    2 => ":flag-al:"
    3 => ":flag-dz:"
    4 => ":flag-as:"
    5 => ":flag-ad:"
    6 => ":flag-ao:"
    7 => ":flag-ai:"
    8 => ":flag-aq:"
    9 => ":flag-ag:"
    ...

Released under the MIT License.