1. Go to this page and download the library: Download atans/emoji-module 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/ */
public function indexAction() {
$emojiService = $this->getServiceLocator()->get('emojimodule_emoji_service');
$text = "\xF0\x9F\x98\x81 Hello World";
$variables = $emojiService->encode($text);
// Output: #1f601# Hello World (You can save it to MySQL now)
// Variables restore to unified
$unified = $emojiService->decode($variables);
// Output: \xF0\x9F\x98\x81 Hello World
// Variables to Html
$variablesToHtml = $emojiService->variablesToHtml($variables);
// Output: <span class="emoji emoji1f601"></span> Hello World
// Unified to html
$unifiedToHtml = $emojiService->unifiedToHtml($unified);
// Output: <span class="emoji emoji1f601"></span> Hello World
return array(
'unifiedToHtml' => $unifiedToHtml,
);
}