PHP Classes

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

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 62%Total: 369 All time: 6,826 This week: 524Up
Version License PHP version Categories
country-code-to-emoj 0.26Custom (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
Picture of Peter Kahl
  Performance   Level  
Name: Peter Kahl <contact>
Classes: 37 packages by
Country: United Kingdom
Age: ???
All time rank: 41521 in United Kingdom
Week rank: 22 Up2 in United Kingdom Up
Innovation award
Innovation award
Nominee: 23x

Winner: 2x

Documentation

Country Code ? ?? Emoji Flag ??

Downloads Download per Month License If this project has business value for you then don't hesitate to support me with a small donation.

Converts a country code to emoji flag. Most flags use a 2-letter code, but some use more (eg England=gbeng, Scotland=gbsct, Wales=gbwls, etc).

Example in action: Screenshot of emoji flags inside phpmyadmin table.

image

Example in action: Screenshot of a terminal window displaying a plain text log file.

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: ?platform- and ?location-dependent??

Not every platform supports emoji. Therefore, use with caution! To my knowledge, iOS, macOS, Android are capable of displaying emoji. Additionally, some platforms (or geographical regions) 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;

echo flagMaster::emojiFlag('uk');    # ??
echo flagMaster::emojiFlag('gbwls'); # ???????
echo flagMaster::emojiFlag('gbsct'); # ???????
echo flagMaster::emojiFlag('gbeng'); # ???????


  Files folder image Files (6)  
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

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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:369
This week:0
All time:6,826
This week:524Up
User Ratings User Comments (1)
 All time
Utility:90%StarStarStarStarStar
Consistency:85%StarStarStarStarStar
Documentation:85%StarStarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:62%StarStarStarStar
Rank:972
 
nice
7 years ago (muabshir)
70%StarStarStarStar