pyrrah/twemoji

The simple way to use Twitter Emoji (Twemoji) for Symfony 6.x.

Installs: 18

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

v1.1.1 2023-11-19 17:41 UTC

This package is auto-updated.

Last update: 2024-12-19 19:48:03 UTC


README

Latest Version on Packagist Software License Total Contributors Total Downloads

This bundle allows you to replace emojis on a web page with emojis from the Twitter Emojis library (Twemoji). Usually, the emojis used come from your system and they are different from one system to another.

Based on Avris\Twemoji.

Since 2023, @jdecked has stopped working for Twitter but continues to maintain the package on Jdecked/Twemoji. We use the latest version.

What is Twemoji ?

Twemoji is a great way to make emoji's on your website independent of system and browser (old repository).

Unless you just use this library to replace emojis with <img> tags in your backend.

Note: it will, of course, increase the server response time (instead removing a flash of system emojis before JS loads). Therefore, it's better suited for generated static websites or HTTP cached requests.

Installation

  1. To install this bundle, run the following Composer command :
composer require pyrrah/twemoji
  1. If you're using Symfony with autowiring, just register the service(s) :
# config/services.yaml
  Pyrrah\Twemoji\TwemojiService: ~
  Pyrrah\Twemoji\TwemojiExtension: ~

Usage

In your controller :

$twemoji->replace('Hello! 👋');
// Hello! <img draggable="false" class="emoji" alt="👋" src="https://twemoji.maxcdn.com/v/14.0.2/svg/1f44b.svg">

Using Twig:

{% filter twemoji %}
  <p>
      Hello! 👋
  </p>
{% endfilter %}
yourBestVar|twemoji

Tests

vendor/bin/phpunit

Credits

License

This bundle is under the MIT license. For the full copyright and license information please view the License File that was distributed with this source code.