β¨ Supports CLDR emoticon storage standard
π Multilingual search from 25 languages
πͺ Replacing unicode emoticons in CLDR format and vice versa
@ This library uses a database of emoticons from - link
Install the package via composer:
composer require deniskorbakov/emoji-phpNow you can use the class with emoticons:
use DenisKorbakov\EmojiPhp\Emojis; new Emojis();Below we will consider the functionality of this class.
This method outputs a grouping of emoticons with a cldr code based on the selected language
use DenisKorbakov\EmojiPhp\Emojis; use DenisKorbakov\EmojiPhp\Locale; new Emojis()->list(Locale::EN); // return ['smileys & emotion' => ['π' => ':grinning_face:', ...]]This method converts the unicode of the emoji to the cldr code - we get unicode emoji from the list method
use DenisKorbakov\EmojiPhp\Emojis; $text = 'Hello, world! ποΈ' new Emojis()->toCode($text); // return 'Hello, world! :globe_showing_europe_africa:'This method converts the one unicode emoji to the cldr code - we get unicode emoji from the list method
use DenisKorbakov\EmojiPhp\Emojis; $emoji = 'π' new Emojis()->codeByEmoji($text); // return ':globe_showing_europe_africa:'This method converts from cldr code with text to unicode emojis - we get cldr from the list method
use DenisKorbakov\EmojiPhp\Emojis; $text = 'Hello :waving_hand:'; new Emojis()->toEmoji($text); // return 'Hello π'This method converts one cldr code to unicode emoji - we get cldr from the list method
use DenisKorbakov\EmojiPhp\Emojis; $text = ':waving_hand:'; new Emojis()->emojiByCode($text); // return 'π'This method searches for emoticons by the word, and you also explicitly specify which language to search in
use DenisKorbakov\EmojiPhp\Emojis; use DenisKorbakov\EmojiPhp\Locale; $searchText = 'shoe' new Emojis()->search(Locale::EN, $searchText); // return ['π' => ':mans_shoe:', ...]Clone this repository:
git clone https://github.com/deniskorbakov/emoji-phpLet's go to the cloned repository:
cd emoji-phpTo start, initialize the project and use it:
make initYou can run the command for testing after the step with local installation
Run Lint and Analyze code(phpstan/rector/phpcs):
make lintRun Unit tests:
make testRun test coverage:
make test-coverageWe appreciate your support and look forward to making our product even better with your help!
π Generated from deniskorbakov/skeleton-php-docker