New in Symfony 7.1: Emoji Improvements
New Emoji Component
Contributed by
Simon Andrรฉ
in #53096.
In Symfony 6.2 we introduced a feature to transliterate and slugify emojis.
This works by adding to the Symfony Intl component all the emoji data from the
ICU library. This data includes the descriptions of all emojis and all its
variants in all languages.
As a result, when you create a fresh new Symfony application, symfony/intl
takes more than 70% of the total installation size (43MB unzipped). This is going
to get worse as more emojis are added in the future.
That’s why in Symfony 7.1 we’ve decided to remove the emoji data from Symfony Intl
and move it to a new Emoji component. The only difference in practice is that
when transliterating/slugifying emojis, you need to run this first in your project
to install the new component:
$ compose require symfony/emoji
Emojify Twig Filter
Contributed by
Grรฉgoire Pineau
in #54432.
For those applications that handle emojis, Symfony 7.1 adds a new emojify filter
that transforms the textual representation of an emoji (e.g. :wave:) into the
actual emoji (๐):
{{ ‚This is :+1: from me’|emojify }} {# renders: This is ๐ from me #}
{{ ‚This is :+1: from me’|emojify(‚github‘) }} {# renders: This is ๐ from me #}
{{ ‚This is :thumbsup: from me’|emojify(‚gitlab‘) }} {# renders: This is ๐ from me #}
The optional argument of the filter defines the emoji catalog that was used to
transliterate the emojis. The gitlab catalog was also introduced in Symfony 7.1
by Antoine Lamirault`_ in `PR #54441.
A Common Emoji Text Code Catalog
Contributed by
Nicolas Grekas
in #54470.
Emojis are the same everywhere, but the text codes used to represent them vary
from one service to another. For example, ๐ฅ is :kiwi-fruit: in GitHub,
:kiwi: in GitLab, and :kiwifruit: in Slack.
That’s why in Symfony 7.1 we’re adding a common emoji text code catalog
that merges the text codes of all the other catalogs into a single one called text:
{{ ‚I like :kiwi-fruit:’|emojify(‚text‘) }} {# renders: I like ๐ฅ #}
{{ ‚I like :kiwi:’|emojify(‚text‘) }} {# renders: I like ๐ฅ #}
{{ ‚I like :kiwifruit:’|emojify(‚text‘) }} {# renders: I like ๐ฅ #}
Symfony Blog