Skip to content

A PHP library simplifying the conversion of unicode, HTML and shortcode emoji πŸ”₯

License

Notifications You must be signed in to change notification settings

elvanto/litemoji

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

69 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LitEmoji πŸ”₯

A PHP library simplifying the conversion of unicode, HTML and shortcode emoji.

Run Tests

Installation

$ composer require elvanto/litemoji

Alternatively you can clone or download the library files.

Usage

use LitEmoji\LitEmoji;

echo LitEmoji::encodeShortcode('Baby you light my πŸ”₯! πŸ˜ƒ');
// 'Baby you light my :fire:! :smiley:'

echo LitEmoji::encodeHtml('Baby you light my :fire:! :smiley:');
// 'Baby you light my 🔥! 😃'

echo LitEmoji::encodeUnicode('Baby you light my :fire:! :smiley:');
// 'Baby you light my πŸ”₯! πŸ˜ƒ'

echo LitEmoji::removeEmoji('Baby you light my πŸ”₯! πŸ˜ƒ!!!');
// 'Baby you light my ! !!!'

Configuration

use LitEmoji\LitEmoji;

// Exclude specific shortcodes when converting from unicode and HTML entities
LitEmoji::config('excludeShortcodes', ['mobile', 'android']);

echo LitEmoji::encodeShortcode('πŸ“±');
// ':iphone:'

// Add aliases for custom shortcodes
LitEmoji::config('aliasShortcodes', ['yeah' => 'thumbsup']);
echo LitEmoji::encodeUnicode('Can do :yeah:!');
// 'Can do πŸ‘!'

Encodings

LitEmoji's various functions will do their best to detect the encoding of the provided text and should work on UTF-8 encoded strings without issue. In cases where the encoding cannot be detected, UTF-8 is assumed, however a second argument can be provided to any of the functions to hint the actual encoded of the provided string.

Contributing

Pull requests are welcome. New code must be fully unit tested (the existing test suite can be run with PHPUnit).

License

MIT License

About

A PHP library simplifying the conversion of unicode, HTML and shortcode emoji πŸ”₯

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages