overtrue/laravel-emoji

An emojione bridge for Laravel 5.

1.1.0 2018-05-26 04:29 UTC

README

😄 This package assist you in getting started with emoji easily.

Installing

$ composer require overtrue/laravel-emoji

Laravel 5.5 auto-discovery supported.

If you are using < laravel 5.5

Add service provider

Overtrue\LaravelEmoji\EmojiServiceProvider::class,

Add alias

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

Usage

Emoji::toImage(':smile:'); // <img class="emojione" alt="&#x1f604;" title=":smile:" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/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 \Emojione\Client instance.
app('emoji');
// or 
app(\Emojione\Client::class);

Configurations && emoji images

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

// png images
$ php artisan vendor:publish --provider="Overtrue\\LaravelEmoji\\EmojiServiceProvider" --tag=public

// sprites images
$ php artisan vendor:publish --provider="Overtrue\\LaravelEmoji\\EmojiServiceProvider" --tag=sprites

PHP 扩展包开发

想知道如何从零开始构建 PHP 扩展包?

请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— 《PHP 扩展包实战教程 - 从入门到发布》

License

MIT