A PHP Emoji conversion library

Overview

php-emoji - Process Emoji in PHP

Build Status

This is a PHP library for dealing with Emoji, allowing you to convert between various native formats and displaying them using HTML.

You can read more about it and see a demo here: http://www.iamcal.com/emoji-in-web-apps/

The data this library is based on comes from another GitHub project: https://github.com/iamcal/emoji-data

USAGE

<?php
include('emoji.php');


# when you recieve text from a mobile device, convert it
# to the unified format.

$data = emoji_docomo_to_unified($data);   # DoCoMo devices
$data = emoji_kddi_to_unified($data);     # KDDI & Au devices
$data = emoji_softbank_to_unified($data); # Softbank & pre-iOS6 Apple devices
$data = emoji_google_to_unified($data);   # Google Android devices


# when sending data back to mobile devices, you can
# convert back to their native format.

$data = emoji_unified_to_docomo($data);   # DoCoMo devices
$data = emoji_unified_to_kddi($data);     # KDDI & Au devices
$data = emoji_unified_to_softbank($data); # Softbank & pre-iOS6 Apple devices
$data = emoji_unified_to_google($data);   # Google Android devices


# when displaying data to anyone else, you can use HTML
# to format the emoji.

$data = emoji_unified_to_html($data);

# if you want to use an editor(i.e:wysiwyg) to create the content, 
# you can use html_to_unified to store the unified value.

$data = emoji_html_to_unified(emoji_unified_to_html($data));

When using the HTML format, you'll also need to include the emoji.css file, which points to the emoji.png image.

IMPORTANT NOTE: This library currently only deals with UTF-8. If your source data is JIS or Shift-JIS, you're out of luck for the moment.

Credits

By Cal Henderson [email protected]

Images and Emoji data come from emoji-data.

This work is dual-licensed under the GPL v3 and the MIT license.

Version History

  • v1.0.0 - 2009-10-20 : First release
  • v1.2.0 - 2011-03-27 : ?
  • v1.3.0 - 2011-07-27 : ?
  • v1.4.0 - 2016-02-15 : Switch to using emoji-data as the backend, at v2.4.0
  • v1.4.1 - 2016-10-06 : Added emoji_contains_emoji(), added travis
  • v1.4.2 - 2017-03-03 : Support for unified modifiers when converting to/from HTML only (issue #34)
Comments
  • Problem to send emoji to Push Notification

    Problem to send emoji to Push Notification

    Hi everybody, I am trying to send pushnotification for ios app. end I am having a problem to send emoji on this push.

    I have this text on my database:

    "\ue415 Vei na boa vou dar um tiro nesse push"

    when I try to send this message to APN(https://github.com/duccio/ApnsPHP) it arrives

    "? Vei na boa vou dar um tiro nesse push"

    Someone know how can I convert this?

    opened by alexleandrom 13
  • generate a map with the latest emoji available

    generate a map with the latest emoji available

    Hi @iamcal I noticed that "http://www.unicode.org/~scherer/emoji4unicode/snapshot/full.html" is outdated and dosen't contains all emoji available in gemoji. I checked also emoji-data which is based on the same file "full.html" but also on "http://www.unicode.org/Public/UNIDATA/UnicodeData.txt" which is updated with all the missing emoji. my request is : could you please integrate the same process of emoji-data in php-emoji in order to generate a map with the latest emoji thanks

    opened by khammami 9
  • Some emoticons leave residual data in the string after conversion

    Some emoticons leave residual data in the string after conversion

    I use emoji_unified_to_html When I convert ❤️️ I have as result : <span class="emoji-outer emoji-sizer"><span class="emoji-inner emoji2764"></span></span>️️ with some residual data : EF B8 8F EF B8 8F

    This emoji is supported by this replacement : "\xe2\x9d\xa4"=>"<span class=\x22emoji-outer emoji-sizer\x22><span class=\x22emoji-inner emoji2764\x22></span></span>",

    but it seems that ❤️️ = \xe2\x9d\xa4\xef\xb8\x8f\xef\xb8\x8f not only \xe2\x9d\xa4

    opened by CedCannes 4
  • Emoji's don't work with APNS-PHP

    Emoji's don't work with APNS-PHP

    I am implementing push notifications on my php server using APNS-PHP (https://github.com/duccio/ApnsPHP). I have emoji hard-coded in my php code like this...

    $message = "\xf0\x9f\x93\x85" . "This is an emoji";
    // do the apns-php stuff here.
    

    Instead of the emoji, I am getting a "?" question mark.

    ?This is an emoji.

    Then I tried using following:

    $message = emoji_unified_to_softbank("\xf0\x9f\x93\x85") . "This is an emoji";
    

    Instead of emoji, this showed the Japanese characters for the particular emoji (calendar)....

    [カレンダー]This is an emoji.

    Is there a workaround for this when using APNS-PHP?

    opened by vikmalhotra 4
  • Legal status of icon set

    Legal status of icon set

    What is the legal status of the images used for these emoticons? Are these taken directly from iOS or are they from some other source? Are they GPL licensed?

    opened by Fauntleroy 3
  • Added new method - html_to_unified

    Added new method - html_to_unified

    Hi,

    I've just added a new method called html_to_unified. In case the user wants to use an editor to create the content to the website.

    This is my case here: I have to create some contents from a website and then the final users can see them on their mobiles. So I need to use HTML version on my site, but I want to store the values in unified format.

    Congratz for this! I'm so happy that I have found it, thanks a lot!

    Thanks in advance, Alberto

    opened by albertoleal 3
  • Checking if text contains emojies

    Checking if text contains emojies

    In our project php-emoji is used to process possible emojis in chat messages. Whilst most of the messages do not contain emojis and we just waste server time.

    I've added the method which will allow us to check if text contains emojis, and skip emojis processing if it doesn't.

    opened by phoenix-mstu 2
  • Add PHP syntax highlighting for easier reading.

    Add PHP syntax highlighting for easier reading.

    I've added the php directive to specify that it should be parsed as PHP. I think this would make it easier for people to read. I know it would for me.

    opened by fieu 2
  • Not working.

    Not working.

    I recently included tested this on my localhost (using xampp) but the functions are returning the same values-- I expect them to be emoji's.

    On my headers are:

    and link rel="stylesheet" type="text/css" media="all" href="emoji/emoji.css"

    function_notworking

    opened by dennisjerdz 2
  • Support new emojis, skin tones, and compound emojis

    Support new emojis, skin tones, and compound emojis

    • built using recent emoji-data with new emojis from 2017, e.g. FaceWith Open Mouth Vomiting
    • support for skin tones
    • support for compound emojis made of serveral single emojis, e.g. Family: Man, Woman, Girl, Boy
    opened by ghost 1
  • Add license scan report and status

    Add license scan report and status

    Your FOSSA integration was successful! Attached in this PR is a badge and license report to track scan status in your README.

    Below are docs for integrating FOSSA license checks into your CI:

    opened by fossabot 1
  • Some Emoji Still Not Supported

    Some Emoji Still Not Supported

    I'm using: $string = $this->emoji->emoji_to_html($string);

    Here's a screen cap of the results while attempting to convert a tweet to HTML. Note how the US flag converts to HTML beautifully, but the IE flag doesn't convert at all.

    image

    opened by era404design 0
  • False positives for  emoji_contains_emoji

    False positives for emoji_contains_emoji

    The using emoji_contains_emoji I noticed a number of maybe false positives, it's up for debate as you could use many of these symbols as emoji. Since I was working with a larger source of user generated content I opted to retrieve valid sources of emoji and Unicode characters. The following is the test scripts. https://github.com/charlesverge/emoji-php-comparsion

    Two examples are

    Detected as emoji ⤂

    Not detected 3️⃣ as emoji

    Not sure if any thing should be changed other than adding a few more emoji into the data set as the false positives for the most part look fine as emoji.

    opened by charlesverge 1
  • Emoji picker corresponding with this library?

    Emoji picker corresponding with this library?

    Thanks you for this amazing library.

    Is there any emoji picker that corresponds with this library?? I mean the picker that produce the exact span? (Then I can convert it to native emoji with this library)

    opened by vahidvdn 0
  • update composer version

    update composer version

    I found this repo in https://packagist.org/packages/iamcal/php-emoji But now there is only "dev-master" version is valid. maybe you should check the repo's "Integrations & services" page.

    opened by tourze 2
Owner
Cal Henderson
Cal Henderson
A PHP Emoji conversion library

php-emoji - Process Emoji in PHP This is a PHP library for dealing with Emoji, allowing you to convert between various native formats and displaying t

Cal Henderson 1.3k Dec 16, 2022
emoji library for PHP.

PHPemoji emoji library for PHP Install composer require amirshnll/php-pemoji Usage code require("PHPemoji.php"); $emoji = new PHPemoji(); echo "Hello

Amir Shokri 5 Jan 28, 2022
PHP Unoconv - An Object Oriented library which allow easy to use file conversion with Unoconv.

An Object Oriented library which allow easy to use file conversion with Unoconv. Install The recommended way to install PHP-Unoconv is thr

Alchemy 69 Dec 3, 2022
Magento2 Plugin for Conversion Pixel/API of Tiktok

Tiktok Conversion Pixel Analytics Plugin Magento2 Table of Contents About Getting Started About Tiktok Pixel is the Plugin used to track events, which

Rishi Gupta 3 Jun 27, 2022
A horrendous PM plugin to manually load all the chunks in your world without logging on. Only for the sole purpose of aiding in PM4 -> DF world conversion.

ChunkLoader A horrendous PM plugin to manually load all the chunks in your world without logging on. Only for the sole purpose of aiding in PM4 -> DF

null 2 Aug 10, 2022
Dobren Dragojević 6 Jun 11, 2023
Easy to use utility functions for everyday PHP projects. This is a port of the Lodash JS library to PHP

Lodash-PHP Lodash-PHP is a port of the Lodash JS library to PHP. It is a set of easy to use utility functions for everyday PHP projects. Lodash-PHP tr

Lodash PHP 474 Dec 31, 2022
PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

php-text-analysis PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP l

null 464 Dec 28, 2022
php-echarts is a php library for the echarts 5.0.

php-echarts 一款支持Apache EChart5.0+图表的php开发库 优先ThinkPHP5/6的开发及测试。 Apache EChart5.0已经最新发布,在视觉效果、动画效果和大数据展示方面已经远超之前的版本; 故不考虑EChart5.0之前版本的兼容问题;建议直接尝试5.0+

youyiio 5 Aug 15, 2022
Minimalist PHP frame for Core-Library, for Developing PHP application that gives you the full control of your application.

LazyPHP lightweight Pre-Made Frame for Core-library Install Run the below command in your terminal $ composer create-project ryzen/lazyphp my-first-pr

Ry-Zen 7 Aug 21, 2022
Gettext is a PHP (^7.2) library to import/export/edit gettext from PO, MO, PHP, JS files, etc.

Gettext Note: this is the documentation of the new 5.x version. Go to 4.x branch if you're looking for the old 4.x version Created by Oscar Otero http

Gettext 651 Dec 29, 2022
Columnar analytics for PHP - a pure PHP library to read and write simple columnar files in a performant way.

Columnar Analytics (in pure PHP) On GitHub: https://github.com/envoymediagroup/columna About the project What does it do? This library allows you to w

Envoy Media Group 2 Sep 26, 2022
:date: The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects

sabre/vobject The VObject library allows you to easily parse and manipulate iCalendar and vCard objects using PHP. The goal of the VObject library is

sabre.io 532 Dec 25, 2022
Small convention based CQRS library for PHP

LiteCQRS for PHP Small naming-convention based CQRS library for PHP (loosely based on LiteCQRS for C#) that relies on the MessageBus, Command, EventSo

Benjamin Eberlei 560 Nov 20, 2022
Experimental library for forking PHP

Spork: PHP on a Fork <?php $manager = new Spork\ProcessManager(); $manager->fork(function() { // do something in another process! return 'Hel

Kris Wallsmith 588 Nov 20, 2022
Collection pipeline library for PHP

Knapsack Collection pipeline library for PHP Knapsack is a collection library for PHP >= 5.6 that implements most of the sequence operations proposed

Dušan Kasan 540 Dec 17, 2022
A PHP library to play with the Raspberry PI's GPIO pins

php-gpio php-gpio is a simple PHP library to play with the Raspberry PI's GPIO pins. It provides simple tools such as reading & writing to pins. [UPDA

Ronan Guilloux 266 Oct 17, 2022
PHP library for dealing with European VAT

ibericode/vat This is a simple PHP library to help you deal with Europe's VAT rules. Fetch VAT rates for any EU member state using ibericode/vat-rates

ibericode 389 Dec 31, 2022
iOS passbook library for PHP 5.4+

PHP PASSBOOK LIBRARY What is Passbook? Passbook is an application in iOS that allows users to store coupons, boarding passes, event tickets, store car

Eymen Gunay 256 Nov 17, 2022