PHP Classes
elePHPant
Icontem

PHP Emoji Country Flags: Convert country code to unicode emoji flags

Recommend this page to a friend!
  Info   View files Documentation   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-04-27 (5 months ago) RSS 2.0 feedStarStarStarStar 68%Total: 262 All time: 7,449 This week: 621Up
Version License PHP version Categories
country-code-to-emoj 0.18Custom (specified...5Graphics, Conversion, Geography
Description Author

This class can convert country code to unicode emoji flags.

It takes the code of a country and returns a string of unicode text of the country flag emoji.

Innovation Award
PHP Programming Innovation award nominee
January 2017
Number 2
Unicode can also be used to display several types of flags including country flags.

This class can take the the letter code of a country and returns a Unicode string for the characters that represents the flag of a country.

Manuel Lemos
  Performance   Level  
Name: Peter Kahl <contact>
Classes: 32 packages by
Country: Hong Kong Hong Kong
Age: ???
All time rank: 6734 in Hong Kong Hong Kong
Week rank: 14 Up1 in Hong Kong Hong Kong Up
Innovation award
Innovation award
Nominee: 19x

Details

Country Code To Emoji Flag ??????????????????

Converts string of country codes to string of emoji flags. As an argument use a single 2-letter country code or a string of multiple codes.

image

image

Why Emoji

Emoji symbol is a textual replacement for a graphic image file while having the benefits of a graphic image. The image file is already present at your intended destination (a person's device), so why would you transmit the image to them again and again? -- Use emoji!

? Green Technology ?

An image file equivalent to an emoji symbol may be tens, hundreds of kilobytes in size, while an emoji symbol is only several bytes. That's a bandwidth saving of around 10,000 times. If you use emoji instead of image files, you reduce your carbon footprint.

Plain Text Is Now ? Faux Rich Text

Now you can include emoji in plain text files, even in plain text emails, making them sharp, colourful and rich looking. You can put emoji flags into your database too!

Emoji Support

Not every platform (hardware + OS) supports emoji. Therefore, use with caution! To my knowledge, iOS, macOS, Android are capable of displaying emoji. Additionally, some platforms may not be able to display certain flags. If unsure, use this as a reference and easy way to test your platform: <http://unicode.org/emoji/charts/full-emoji-list.html>

use peterkahl\flagMaster\flagMaster;

# Single flag
echo flagMaster::emojiFlag('uk'); # ??

# String of multiple flags
echo flagMaster::emojiFlag('ukcwsxap'); # ???????

Bonus Gift ? -- SQL Emoji Flags

Use the extra file update-table-flags.sql to insert emoji flags into your SQL table. Make sure to use the following settings:


$link = mysqli_connect($HOSTNAME, $USERNAME, $PASSWORD, $DBNAME);

mysqli_set_charset($link, "utf8mb4");

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Image file logfile-example.png Icon Icon image
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Image file screenshot-phpmyadmin-flags.png Data Auxiliary data
Accessible without login Plain text file update-table-flags.sql Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Plain text file flagMaster.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:262
This week:0
All time:7,449
This week:621Up
User Ratings User Comments (1)
 All time
Utility:100%StarStarStarStarStarStar
Consistency:93%StarStarStarStarStar
Documentation:93%StarStarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:68%StarStarStarStar
Rank:494
 
nice
7 months ago (muabshir)
70%StarStarStarStar