abei2017 / yii2-emoji
一个yii2的emoji扩展
Installs: 1 123
Dependents: 0
Suggesters: 0
Security: 0
Stars: 17
Watchers: 1
Forks: 2
Open Issues: 0
Type:yii2-extension
Requires
- emojione/emojione: ^3.1
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2025-03-18 19:30:13 UTC
README
这是一套供yii2框架使用的emoji表情库。
Install
$ composer require abei2017/yii2-emoji
only used in yii2.
Usage
use abei2017\emoji\Emoji; Emoji::shortnameToImage('hello:smile:');// hello <img class="emojione" alt="😄" title=":smile:" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/32/1f604.png"> Emoji::toShort('😄'); // :smile: Emoji::unicodeToImage('😄'); // <img class="emojione" alt="😄" title=":smile:" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/32/1f604.png"> Emoji::toImage(':smile:'); // <img class="emojione" alt="😄" title=":smile:" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/32/1f604.png"> Emoji::shortnameToUnicode(':smile:'); // 😄
Config
// config/web.php return [ ... 'yii2Emoji'=>[ 'emojiSize'=>'32',//32、64、128 ] ];
Use Behavior (>= v1.1.0)
// in ActiveRecord use abei2017\emoji\ValBehavior; public function behaviors(){ return [ 'hello'=>[ 'class'=>'abei2017\emoji\ValBehavior', 'valAttribute'=>'content',// no set, default "content" 'inFunc'=>'toShort'// no set, default "toShort", and you can set "shortnameToUnicode" ] ]; }
License
MIT