xuejd3/laravel-emoji

An emojione bridge for Laravel

0.0.2 2020-03-09 06:56 UTC

This package is auto-updated.

Last update: 2020-07-09 08:21:32 UTC


README

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

Installing

$ composer require xuejd3/laravel-emoji

Laravel auto-discovery supported.

If you are using < laravel 5.5

Add service provider

Xuejd3\LaravelEmoji\EmojiServiceProvider::class,

Add alias

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

Usage

Emoji::toImage(':smile:'); // <img class="joypixels" alt="&#x1f604;" title=":smile:" src="https://cdn.jsdelivr.net/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);

Configurations

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

License

MIT