10quality/php-emoji

PHP Emoji coverter library.

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

This package is auto-updated.

Last update: 2023-01-08 23:59: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

Emoji Characters Emoji Characters
Heart <3 Heart ðŸ’
Coffee ☕� Smile face :)
Smile :D Pensive face :(
Crying face :'( Savouring face :P
Smiling halo O:) Confused o.O
Winking ;) Astonished :O
Expressionless -_- Angry >:O
Kissing :* Cheerful ^_^
Eyeglasses 8-) Sunglasses 8|
Unamused >:( Flushed
Thumbs Up (y) Right

License

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