Skip to content

deniskorbakov/emoji-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Emoji PHP

GitHub Workflow Status GitHub Workflow Status Total Downloads Latest Version License

✨ 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

πŸ“ Getting Started

Install the package via composer:

composer require deniskorbakov/emoji-php

Now you can use the class with emoticons:

use DenisKorbakov\EmojiPhp\Emojis;

new Emojis();

Below we will consider the functionality of this class.

πŸ“– Examples & Usage

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 code of the emoji face to the cldr code - we get unicode emoji face 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 a smiley face from cldr code to unicode - we get cldr from the list method

use DenisKorbakov\EmojiPhp\Emojis;

$text = 'Hello :waving_hand:';

new Emojis()->toEmoji($text);
// return 'Hello πŸ‘‹'

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:', ...]

βš’οΈ Local Development

Clone this repository:

git clone https://github.com/deniskorbakov/emoji-php

Let's go to the cloned repository:

cd emoji-php

To start, initialize the project and use it:

make init

πŸ§ͺ Testing

You can run the command for testing after the step with local installation

Run Lint and Analyze code(phpstan/rector/phpcs):

make lint

Run Unit tests:

make test

Run test coverage:

make test-coverage

🀝 Feedback

We appreciate your support and look forward to making our product even better with your help!

@Denis Korbakov


πŸ“ Generated from deniskorbakov/skeleton-php-docker

About

πŸ““ Emojis in PHP - replacement, search, conversion using CLDR standard

Topics

Resources

License

Stars

Watchers

Forks

Languages