avris/twemoji

Backend-generated Twitter Emoji

Maintainers

Details

gitlab.com/Avris/Twemoji

Source

Issues

Installs: 358

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:project

v0.1.3 2022-11-12 18:27 UTC

This package is auto-updated.

Last update: 2024-03-12 21:25:16 UTC


README

Backend-generated Twitter Emoji

Twemoji is a great way to make emoji's on your website independent of system and browser. But alas, it requires JavaScript...

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

composer req avris/twemoji

If you're using Symfony with autowiring, just register the service(s):

Avris\Twemoji\TwemojiService: ~
Avris\Twemoji\TwemojiExtension: ~

Usage

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

Or using Twig:

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

Tests

vendor/bin/phpunit

Copyright