学典3/laravel-emoji

Laravel 的 emojione 桥接器

1.0.0 2021-02-09 14:56 UTC

This package is auto-updated.

Last update: 2024-09-09 22:33:38 UTC


README

😄 此软件包可以帮助您轻松开始使用emoji。

安装

$ composer require xuejd3/laravel-emoji

Laravel 自动发现支持。

如果您使用的是 < laravel 5.5

添加服务提供者

Xuejd3\LaravelEmoji\EmojiServiceProvider::class,

添加别名

'Emoji' => Xuejd3\LaravelEmoji\Emoji::class,

用法

Emoji::toImage(':smile:'); // <img class="joypixels" alt="&#x1f604;" title=":smile:" src="https://cdn.jsdelivr.net.cn/joypixels/assets/5.0/png/unicode/32/1f604.png">
Emoji::toShort('😄'); // :smile:
Emoji::shortnameToUnicode(':smile:'); // 😄

// using helper
// default transform shorname to unicode, you can change it in config file.
emoji(':smile:'); // 😄

// access emoji services, return \JoyPixels\Client instance.
app('emoji');
// or 
app(\JoyPixels\Client::class);

配置

// config
$ php artisan vendor:publish --provider="Xuejd3\\LaravelEmoji\\EmojiServiceProvider"

许可证

MIT