/emoji

PHP library for detecting emojis in text with support of Unicode 11 emojis and skin tones

Primary LanguagePHPMIT LicenseMIT

Tequila Emoji

This library provides simple facade class to detect emoji in text. At the moment, library is able to detect all emoji, including added in Unicode 11. Regular expression is taken from Adam Merrifield's answer on Stack Overflow and is slightly modified to detect emoji with skin tones.

Installation

The library should be installed by Composer:

composer require tequila/emoji

Usage

<?php

use Tequila\Emoji\Emoji;

$text = 'This string contains emojis: 😎 😍 😘👊🏿 ✊🏿 🤛🏿';

// Check if text contains emoji
$textContainsEmoji = Emoji::presentInText($text); // true

// Detect all emoji in text
$detectedEmoji = Emoji::detectInText($text); // ['😎', '😍', '😘', '👊🏿', '✊🏿', '🤛🏿']

Support

If you need additional functionality - feel free to create an issue.