Download the PHP package aksafan/yii2-emoji-detection without Composer
On this page you can find all versions of the php package aksafan/yii2-emoji-detection. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aksafan/yii2-emoji-detection
More information about aksafan/yii2-emoji-detection
Files in aksafan/yii2-emoji-detection
Package yii2-emoji-detection
Short Description Yii2 wrapper for aaronpk's Emoji Detection
License MIT
Homepage https://github.com/aksafan/yii2-emoji-detection
Informations about the package yii2-emoji-detection
yii2-emoji-detection
Yii2 wrapper for aaronpk's Emoji Detection (https://github.com/aaronpk/emoji-detector-php). The library provides all aaronpk's Emoji Detection tools and features with various enhancements and Yii2 syntax.
Installation
The preferred way to install this extension is through composer. Check the composer.json for this extension's requirements and dependencies. Read this composer.json for source library requirements.
To install, either run
or add
to the require
section of your composer.json
file.
Configuration
To use this extension, you have to configure the EmojiDetector class in your application configuration:
Also add this to your Yii.php file in the root directory of the project for IDE code autocompletion.
Now u can get access to extension's methods through:
Basic Usage
Detect Emoji
The method returns an array with details about each emoji found in the string.
emoji
- The emoji sequence found, as the original byte sequence. You can output this to show the original emoji.short_name
- The short name of the emoji, as defined by Slack's emoji data.num_points
- The number of unicode code points that this emoji is composed of.points_hex
- An array of each unicode code point that makes up this emoji. These are returned as hex strings. This will also include "invisible" characters such as the ZWJ character and skin tone modifiers.hex_str
- A list of all unicode code points in their hex form separated by hyphens. This string is present in the Slack emoji data array.skin_tone
- If a skin tone modifier was used in the emoji, this field indicates which skin tone, since theshort_name
will not include the skin tone.
Detect Emoji and return only one specific param
The method returns an array with details about each emoji found in the string.
Possible params:
aksafan\emoji\source\EmojiDetector::EMOJI
- The emoji sequence found, as the original byte sequence. You can output this to show the original emoji.aksafan\emoji\source\EmojiDetector::SHORT_NAME
- The short name of the emoji, as defined by Slack's emoji data.aksafan\emoji\source\EmojiDetector::NUM_POINTS
- The number of unicode code points that this emoji is composed of.aksafan\emoji\source\EmojiDetector::POINTS_HEX
- An array of each unicode code point that makes up this emoji. These are returned as hex strings. This will also include "invisible" characters such as the ZWJ character and skin tone modifiers.aksafan\emoji\source\EmojiDetector::HEX_STR
- A list of all unicode code points in their hex form separated by hyphens. This string is present in the Slack emoji data array.aksafan\emoji\source\EmojiDetector::SKIN_TONE
- If a skin tone modifier was used in the emoji, this field indicates which skin tone, since theshort_name
will not include the skin tone.
Replace Emoji with given replacer
Count Emojis in text
Test if a string is a single emoji
Since simply counting the number of unicode characters in a string does not tell you how many visible emoji are in the string, determining whether a single character is an emoji is more involved.
Test if a string has one or more emoji
Get Emojis' map
The method returns an array of key-values pairs of emoji hex unicode and its short (friendly) name.
Get Emojis' regexp. The method returns a string with regexp (build on emojis' map) to detect emojis
License
Copyright 2018 by Anton Khainak.
Available under the MIT license.
Emoji Detection data sourced from aaronpk/emoji-detector-php under the MIT license.
All versions of yii2-emoji-detection with dependencies
yiisoft/yii2 Version >=2.0.50
p3k/emoji-detector Version ^1
ext-json Version *
ext-mbstring Version *