oh/emoji-bundle
oh/emoji-bundle adds emoji support to PHP applications, making it easier to work with emoji characters and shortcodes in content, templates, and user input. It simplifies parsing, rendering, and handling emoji data so Laravel and PHP developers can build emoji-friendly features without custom logic.
ollieLtd/OhEmojiBundle, but the Packagist name is not guaranteed to be ollie/oh-emoji-bundle. Run composer show --all against the repo or check the README before committing.composer.json before installing. This is a Symfony bundle, not a Laravel package. Check whether it requires symfony/framework-bundle, symfony/dependency-injection, or symfony/twig-bundle — those pull in dead weight and may conflict with illuminate/* versions in a Laravel app.src/ for the service that actually does the unicode → HTML/CSS mapping (likely something like EmojiConverter, EmojiTwigExtension, and a DependencyInjection/Configuration.php). If the converter has no Symfony container dependencies, you can use it directly and ignore the bundle plumbing. If it does, extract the converter into your own App\Support\Emoji class.DependencyInjection/Configuration.php: sprite path, class prefix, image size, and whether it emits <span> vs <img>. Those map to your config/emoji.php.<span class="emoji emoji-…"></span> or <img> tags.public/ and include it in your base layout — without it you get empty spans.@emoji($text) in AppServiceProvider::boot(). Prefer this over a global function so you can mock it in tests.getBodyHtmlAttribute()) or in the view. Changing sprite/class prefix later should never require a data migration.ApiResource::toArray() so mobile clients get the same HTML the web sees, rather than pushing sprite assets to every client.hash('xxh3', $raw) in Redis for repeated strings (e.g., comment bodies in a hot feed).text/html responses on an allowlist of paths.App\Contracts\EmojiConverter) and register the package implementation in a service provider. This is your escape hatch if the package is abandoned.tests/fixtures/emoji/ covering: plain text, single emoji, skin-tone modifiers, ZWJ sequences (family, profession), flags (regional indicator pairs), variation selectors, existing HTML entities, and mixed emoji + <script> to prove escaping still works.eval-based.<span class="emoji-…"> markup locks you into the current sprite and class naming forever.U+1F3FB–1F3FF), ZWJ joins (U+200D), flags (two regional indicators), variation selector U+FE0F. If the package uses simple mb_str_split, expect missed or double conversions on these. Test them explicitly.{!! emoji($text) !!} is only safe if $text was already escaped before conversion. Escape input, then convert — never the other way around.U+FE0F variation selector or a non-UTF-8 column collation is the usual culprit. A small tinker command that shows input codepoints vs output HTML will save hours.How can I help you explore Laravel packages today?