sunaoka/emoji-utility

Utilities for Emoji using PHP

v1.0.3 2024-10-07 00:56 UTC

This package is auto-updated.

Last update: 2024-12-07 01:44:58 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-utility

Usage

<?php

use Sunaoka\EmojiUtility\Parsers\EmojiTest;

$parser = new EmojiTest();
$data = $parser->parse('emoji-test.txt');

var_dump($data);

output is ...

array(4) {
  ["date"]    => string(24) "2023-06-05, 21:39:54 GMT"
  ["version"] => string(4)  "15.1"
  ["url"]     => string(52) "https://unicode.org/Public/emoji/15.1/emoji-test.txt"
  ["emoji"]   => array(5034) {
    [0] => array(7) {
      ["group"]      => string(17) "Smileys & Emotion"
      ["subgroup"]   => string(12) "face-smiling"
      ["codepoints"] => string(5)  "1F600"
      ["status"]     => string(15) "fully-qualified"
      ["emoji"]      => string(4)  "😀"
      ["name"]       => string(13) "grinning face"
      ["version"]    => string(3)  "1.0"
    }
    :
    :
  }
}

Options

sort

see: Arrays > Predefined Constants > Sorting order flags.

<?php

use Sunaoka\EmojiUtility\Parsers\EmojiTest;

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

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

emoji-test.txt