sunaoka/emoji-parser

This package is abandoned and no longer maintained. The author suggests using the sunaoka/emoji-utility package instead.

Parsing unicode emoji text file using PHP

1.5.0 2023-11-20 02:57 UTC

This package is auto-updated.

Last update: 2023-11-22 08:36:51 UTC


README

Latest Stable Version License PHP Test codecov

Library to parse emoji-test.txt (emoji-test.txt file provides data for testing which emoji forms should be in keyboards and which should also be displayed/processed).

Installation

composer require sunaoka/emoji-parser

Usage

<?php

use Sunaoka\EmojiParser\EmojiParser;

$emojiParser = new EmojiParser('emoji-test.txt');
$data = $emojiParser->parse();

print_r($data);

output is ...

(
    [date] => 2020-01-21, 13:40:25 GMT
    [version] => 13.0
    [url] => https://unicode.org/Public/emoji/13.0/emoji-test.txt
    [emoji] => Array
        (
            [0] => Array
                (
                    [group] => Smileys & Emotion
                    [subgroup] => face-smiling
                    [code_point] => 1F600
                    [status] => fully-qualified
                    [emoji] => 😀
                    [name] => grinning face
                    [version] => 1
                )
  :
  :

Options

sort

see: Arrays > Predefined Constants > Sorting order flags.

<?php

use Sunaoka\EmojiParser\EmojiParser;

$options = [
    'sort' => SORT_ASC,
];

$emojiParser = new EmojiParser('emoji-test.txt', $options);
$data = $emojiParser->parse();

emoji-test.txt

Version URL
15.1 https://unicode.org/Public/emoji/15.1/emoji-test.txt
15.0 https://unicode.org/Public/emoji/15.0/emoji-test.txt
14.0 https://unicode.org/Public/emoji/14.0/emoji-test.txt
13.1 https://unicode.org/Public/emoji/13.1/emoji-test.txt
13.0 https://unicode.org/Public/emoji/13.0/emoji-test.txt
12.1 https://unicode.org/Public/emoji/12.1/emoji-test.txt
12.0 https://unicode.org/Public/emoji/12.0/emoji-test.txt
11.0 https://unicode.org/Public/emoji/11.0/emoji-test.txt
5.0 https://unicode.org/Public/emoji/5.0/emoji-test.txt
4.0 https://unicode.org/Public/emoji/4.0/emoji-test.txt