10quality/php-emoji

PHP 表情符号转换库。

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

This package is auto-updated.

Last update: 2024-09-09 04:11:03 UTC


README

将某些表情符号转换为公共svg(html)的库。

安装

使用composer

composer require 10quality/php-emoji

使用方法

使用全局函数

// 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('ðŸ’');

使用 Emoji

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);

支持的表情符号

许可协议

版权所有 (c) 2017 10Quality。在MIT许可证下。