1. Introduction
In the social network so developed today, Emoji expression package everywhere, whether it is QQ, Weibo or the major forums, everywhere is the figure of expression package. As a developer, you may need to provide a variety of emoticons in your app for users to comment on and communicate with.
PHP 5 has supported the conversion of Unicode strings to emoticons, but more complex:
PHP 7 provides better support for Unicode strings, which makes it easier to display emoticons:
Of course, such coding is unfriendly, we need to use a more readable way to achieve the expression, fortunately, in Laravel, we can through the Laravel Emoji this extension package to achieve this purpose.
2. Installation
System requirements: PHP 5.4+/HHVM 3.3+,composer
To install the latest version of Laravel Emoji, declare the following dependencies in Composer.json:
"Unicodeveloper/laravel-emoji": "1.0.*"
Then run composer install or composer update to download and install the expansion pack.
After the installation is complete, you need to register the service provider, and in the configuration file app.php, add the following code to the providers array:
Unicodeveloper\emoji\emojiserviceprovider::class
Also, do not forget to register the façade to the aliases array:
' Aliases ' = [ ... '] Emoji ' = Unicodeveloper\emoji\facades\emoji::class, ...]
3. Use
Laravel Emoji provides us with a variety of ways to display emoticons and then unify calls through the Emoji façade:
For more Emoji emoticons, please see the full Emoji emoji list.