10quality/php-emoji

PHP Emoji coverter library.

v1.0.2 2017-11-07 17:17 UTC

This package is auto-updated.

Last update: 2024-10-09 04:23:20 UTC


README

Library to convert certain emojis to public svgs (html).

Install

With composer:

composer require 10quality/php-emoji

Usage

Using global functions:

// Following example will return an svg url
// -- echos 'https://s.w.org/images/core/emoji/2.3/svg/1f497.svg'
echo emoji_to_img('ðŸ’');

// Following example will return an svg wrapped in an image HTML tag
// -- echos '<img class="emoji" alt="emoji-heart" src="https://s.w.org/images/core/emoji/2.3/svg/1f497.svg"/>'
echo emoji_to_html('ðŸ’');

Using Emoji class:

use TenQuality\Utility\Emoji;

/**
 * @param string First param is the text you want to convert.
 * @param string Second param is the type of output wanted.
 */
echo Emoji::convert('ðŸ’', Emoji::URL);
echo Emoji::convert('ðŸ’', Emoji::HTML);

Supported Emojis

License

Copyright (c) 2017 10Quality. Under MIT License.