Skip to content

abei2017/yii2-emoji

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

εŒ—ε“₯开源扩展 εŒ—ε“₯开源扩展 εŒ—ε“₯开源扩展

Β  θΏ™ζ˜―δΈ€ε₯—δΎ›yii2ζ‘†ζžΆδ½Ώη”¨ηš„emoji葨情库。

Install

$ composer require abei2017/yii2-emoji

only used in yii2.

Video

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