The PHPLeague/CommonMark extension for emoji's support.
Include the library as dependency in your own project via:
composer require "fdekker/commonmark-ext-emoji"
// Define your configuration, if needed
$config = [];
// Configure the Environment with all the CommonMark and GFM parsers/renderers
$environment = new Environment($config);
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new GithubFlavoredMarkdownExtension());
$environment->addExtension(new EmojiExtension(EmojiDataProvider::light()));
$converter = new MarkdownConverter($environment);
echo $converter->convert('Works (y) :thumbsup: (thumbsup)');
Outputs:
Works 👍 👍 👍
To read more about configuring extension visit: https://commonmark.thephpleague.com/2.4/extensions/github-flavored-markdown/
You can implement EmojiDataProviderInterface
to supply your own emoji's list.