PHP code example of biangbiang / emoji

1. Go to this page and download the library: Download biangbiang/emoji library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

biangbiang / emoji example snippets



ji = new Biang\Emoji\Emoji();

$text  = 'hello โ˜บ๐Ÿ˜˜๐Ÿ˜œ๐Ÿค“๐Ÿ˜ถ๐Ÿ™„๐Ÿ˜Ÿ๐Ÿ˜•๐Ÿ˜ซ๐Ÿ˜ฑ๐Ÿ˜ฆ๐Ÿ˜ช๐Ÿ˜ฒ๐Ÿค•๐Ÿ˜๐Ÿ˜…๐Ÿ˜Š๐Ÿ˜‹๐Ÿ˜—๐Ÿ˜๐Ÿ˜Ž๐Ÿ˜๐Ÿค”๐Ÿ˜ ๐Ÿ™๐Ÿ˜ฉ๐Ÿ˜จ๐Ÿ˜ง๐Ÿ˜“๐Ÿค๐Ÿ˜ด๐Ÿ˜‚๐Ÿ˜†๐Ÿ™‚๐Ÿ™‚๐Ÿ˜Œ๐Ÿ˜™๐Ÿ˜›๐Ÿค—๐Ÿ˜‘๐Ÿ˜ณ๐Ÿ˜ก๐Ÿ˜ฃ๐Ÿ˜ค๐Ÿ˜ฐ๐Ÿ˜ข๐Ÿ˜ญ๐Ÿ˜ท world';
$smile = '๐Ÿ™‚';

// transform emoji to utf-8
$utf8Text = $emoji->emojiToUtf8($smile);

// remove emoji from text
$removeText = $emoji->removeEmoji($text);

// transform emoji to string with transformDict
$transformDict = array(
    "\xF0\x9F\x99\x82" => "[ๅพฎ็ฌ‘]",
    "\xF0\x9F\x98\x84" => "[ๅ˜ปๅ˜ป]",
    "\xF0\x9F\x98\xAC" => "[ๅ“ˆๅ“ˆ]",
    "\xF0\x9F\x98\x87" => "[ๅฏๆ€œ]",
    "\xF0\x9F\x98\x86" => "[ๆŒ–้ผป]" ,
    "\xF0\x9F\x98\xA5" => "[ๅƒๆƒŠ]",
    "\xF0\x9F\x98\x93" => "[ๅƒๆƒŠ]",
    "\xF0\x9F\x99\x84" => "[ๅฎณ็พž]",
    "\xF0\x9F\x98\x9C" => "[ๆŒค็œผ]",
    "\xF0\x9F\x98\x9D" => "[ๆŒค็œผ]",
    "\xF0\x9F\x98\x9B" => "[ๆŒค็œผ]",
    "\xF0\x9F\xA4\x90" => "[้—ญๅ˜ด]",
    "\xF0\x9F\x98\xB7" => "[้—ญๅ˜ด]",
    "\xF0\x9F\x98\x90" => "[้„™่ง†]",
    "\xF0\x9F\x98\xB5" => "[็ˆฑไฝ ]",
    "\xF0\x9F\x98\xAD" => "[ๆณช]",
    "\xF0\x9F\x98\x81" => "[ๅท็ฌ‘]",
    "\xF0\x9F\x98\x9A" => "[ไบฒไบฒ]",
    "\xF0\x9F\x98\x99" => "[ไบฒไบฒ]",
    "\xF0\x9F\x98\x96" => "[็”Ÿ็—…]",
    "\xF0\x9F\x98\x8A" => "[ๅคชๅผ€ๅฟƒ]" ,
    "\xF0\x9F\x98\x81" => "[็™ฝ็œผ]",
    "\xF0\x9F\x98\x97" => "[ๅณๅ“ผๅ“ผ]",
    "\xF0\x9F\x98\x9A" => "[ๅทฆๅ“ผๅ“ผ]",
    "\xF0\x9F\x98\x91" => "[ๅ˜˜]",
    "\xF0\x9F\x98\xA2" => "[่กฐ]",
    "\xF0\x9F\x98\xB2" => "[ๅง”ๅฑˆ]",
    "\xF0\x9F\x98\xA4" => "[ๅ]",
    "\xF0\x9F\x98\xB4" => "[ๅ“ˆๆฌ ]",
    "\xF0\x9F\x98\x9D" => "[ๆŠฑๆŠฑ]",
    "\xF0\x9F\x98\xA1" => "[ๆ€’]",
    "\xF0\x9F\xA4\x94" => "[็–‘้—ฎ]",
    "\xF0\x9F\x98\x8B" => "[้ฆ‹ๅ˜ด]",
    "\xF0\x9F\x98\x94" => "[ๆ€่€ƒ]",
    "\xF0\x9F\x98\x85" => "[ๆฑ—]",
    "\xF0\x9F\x98\xAF" => "[ๅ›ฐ]",
    "\xF0\x9F\x98\xAA" => "[็ก]",
    "\xF0\x9F\x98\xB0" => "[็ก]",
    "\xF0\x9F\xA4\x91" => "[้’ฑ]",
    "\xF0\x9F\x98\xAE" => "[ๅคฑๆœ›]",
    "\xF0\x9F\x98\x8E" => "[้…ท]",
    "\xF0\x9F\x98\x8d" => "[่‰ฒ]",
    "\xF0\x9F\x98\x92" => "[ๅ“ผ]",
    "\xF0\x9F\xA4\x97" => "[้ผ“ๆŽŒ]",
    "\xF0\x9F\x98\xA8" => "[ๆ™•]",
    "\xF0\x9F\x98\x9F" => "[ๆ‚ฒไผค]",
    "\xF0\x9F\x98\xAB" => "[ๆ‚ฒไผค]",
    "\xF0\x9F\x98\xA9" => "[ๆ‚ฒไผค]",
    "\xF0\x9F\x98\x8C" => "[ๆ‚ฒไผค]",
    "\xF0\x9F\x98\xA0" => "[ๆŠ“็‹‚]",
    "\xF0\x9F\x98\x95" => "[้ป‘็บฟ]",
    "\xF0\x9F\x98\x8F" => "[้ป‘็บฟ]",
    "\xF0\x9F\x99\x81" => "[้˜ด้™ฉ]",
    "\xF0\x9F\x98\xA3" => "[ๆ€’้ช‚]",
    "\xF0\x9F\x98\xA6" => "[ๅฟƒ]",
    "\xF0\x9F\x98\x9E" => "[ไผคๅฟƒ]",
    "\xF0\x9F\x98\x92" => "[ไผคๅฟƒ]",
    "\xF0\x9F\x98\xB6" => "[็Œชๅคด]",
    "\xF0\x9F\x98\xA7" => "[็ฅž้ฉฌ]",
    "\xF0\x9F\xA4\x93" => "[ๅŽปๆ—…่กŒ]",
    "\xF0\x9F\x98\x89" => "[ๆœ€ๅณ]",
    "\xF0\x9F\x98\xB3" => "[doge]",
    "\xF0\x9F\x98\xB1" => "[ๅ–ตๅ–ต]",
    "\xF0\x9F\x98\x82" => "[็ฌ‘cry]",
    "\xF0\x9F\xA4\x92" => "[่Š’ๆžœๅพ—ๆ„]",
    "\xF0\x9F\x99\x83" => "[ๅ€’]",
    "\xF0\x9F\xA4\x95" => "[ๅ—ไผค]"
);
$transformText = $emoji->transformEmoji($transformDict, $text);