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
Requires
- php: ^7.0|^8.0
- symfony/cache: ^4.0|^5.0|^6.0
- symfony/http-client: ^4.0|^5.0|^6.0
Requires (Dev)
- phpunit/phpunit: ^7.5
- symfony/var-dumper: ^4.0|^5.0
- twig/twig: ^2.12
Suggests
- twig/twig: Provides a Twig filter
README
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
- To install this bundle, run the following Composer command :
composer require pyrrah/twemoji
- 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.