- How do I install LitEmoji in a Laravel project?
- Run `composer require elvanto/litemoji` in your project root. The package integrates seamlessly with Laravel’s autoloader and provides a `LitEmoji` facade for easy usage. No additional configuration is required for basic functionality.
- Which Laravel versions does LitEmoji support?
- LitEmoji officially supports Laravel 10+ (PHP 8.1+) and Laravel 11+ (PHP 8.2+). For PHP 8.3/8.4, ensure you’re using version 5.2.0 or later. Older Laravel versions may require manual facade adjustments or dependency tweaks.
- Can I exclude certain emoji shortcodes from conversion?
- Yes, use `LitEmoji::config('excludeShortcodes', ['shortcode1', 'shortcode2'])` to skip specific shortcodes during Unicode or HTML-to-shortcode conversion. This is useful for filtering out platform-specific or irrelevant emoji.
- How does LitEmoji handle deprecated emoji (e.g., 👨👩👧👦 → 👨👩👧👦)?
- Emojibase 16 updates may replace deprecated emoji. Use `Emoji::getAll()` to audit mappings post-upgrade, then log warnings for deprecated emoji via `Log::warning()`. For legacy data, manually migrate or replace deprecated shortcodes in your database.
- Does LitEmoji work with Laravel’s Eloquent or database storage?
- Yes, LitEmoji integrates with Eloquent and can process emoji in database fields. For new Emojibase 16 emoji, ensure your schema supports UTF-8MB4 (e.g., `utf8mb4_unicode_ci` collation). Use migrations to update legacy emoji data if needed.
- How do I add custom emoji aliases (e.g., `:yeah: = :thumbsup:`)?
- Use `LitEmoji::config('aliasShortcodes', ['yeah' => 'thumbsup'])` to define custom aliases. These will apply during Unicode-to-shortcode conversion. Test thoroughly to avoid conflicts with existing shortcodes.
- Will LitEmoji break if I upgrade to PHP 8.3/8.4 with Laravel 11?
- No breaking changes are expected for PHP 8.3/8.4, but test with `composer require elvanto/litemoji:^5.2.0` to confirm compatibility. Laravel 11’s type system or attributes won’t conflict with LitEmoji’s core functionality.
- Can I use LitEmoji with Laravel Scout for search indexing?
- Yes, but reindex existing content after upgrading to Emojibase 16, as new emoji (e.g., 🧑🔬) may require updated search terms. Use `Emoji::toUnicode()` or `Emoji::toHtml()` in custom analyzers for consistent indexing.
- How do I remove all emoji from a string in Laravel Blade?
- Use `{{ Emoji::removeEmoji($text) }}` in Blade templates to strip emoji. This works for both Unicode (😀) and HTML entities (😀). For bulk processing, apply it in controllers or service providers.
- Are there alternatives to LitEmoji for Laravel emoji handling?
- Alternatives include `symfony/string` (for basic emoji detection) or `league/html-to-markdown` (for Markdown emoji support). However, LitEmoji is optimized for Laravel with Emojibase 16 integration, shortcode exclusions, and UTF-8 handling out of the box.