tequila/emoji

PHP library to detect emojis in text with support of Unicode 11 emojis and skin tones

v1.0.0 2019-03-14 16:22 UTC

This package is auto-updated.

Last update: 2024-05-15 04:43:25 UTC


README

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.