Laravel Emoji-Integrated use of Emoji emoticons in Laravel applications

Source: Internet
Author: User
Tags composer install

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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.