Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Emoji Laravel Package

spatie/emoji

Work with emoji in PHP without relying on your IDE/font. Use the Spatie\Emoji\Emoji class to access emoji as constants or friendly camelCase methods like Emoji::grinningFace(), or fetch all emojis via Emoji::all().

View on GitHub
Deep Wiki
Context7

Programatically work with emoji characters

Frequently asked questions about Emoji
How do I install and use Spatie Emoji in a Laravel project?
Install via Composer with `composer require spatie/emoji`. Use `Emoji::grinningFace()` for individual emojis or `Emoji::all()` for a full list. Laravel Blade directives like `@emoji` simplify frontend rendering without manual Unicode input.
Does this package support Laravel validation for emoji inputs?
Yes. Use `Rule::emoji()` in Laravel’s validation system to validate emoji inputs server-side. It integrates natively with Laravel’s validation pipeline, ensuring only valid emojis are accepted.
Can I use emoji shortcodes (e.g., `:smile:`) instead of Unicode?
No, this package only supports Unicode emojis (e.g., `😃`). For shortcodes, you’ll need a custom wrapper or a third-party tool like `symfony/mime` to map `:smile:` to `😃` before processing.
What Laravel versions and PHP requirements does Spatie Emoji support?
The package requires PHP 8.1+ and is optimized for Laravel 9+. It’s tested against modern Laravel releases, including Blade 3.x, but always check the [GitHub repo](https://github.com/spatie/emoji) for compatibility updates.
How do I store emojis in a database with Eloquent?
Use Eloquent’s `casts` property to define emojis as strings. For validation, add `Rule::emoji()` to your form requests. Example: `protected $casts = ['emoji_column' => 'string'];` in your model.
Are there performance concerns for real-time emoji processing (e.g., live chat)?
For high-throughput systems, consider caching emoji conversions or batch processing. The package isn’t optimized for real-time heavy loads, but Blade directives and Eloquent casting are lightweight for typical use cases.
Does Spatie Emoji support country flags or regional emojis?
Yes, use `Emoji::countryFlag('US')` for country flags (ISO 3166-1 Alpha-2 codes). For regional variants (e.g., skin tone modifiers like `👩🏽`), the package supports Unicode sequences, but custom logic may be needed for edge cases.
How do I handle missing emojis or Unicode updates?
The package uses a static Emoji 15.1 dataset. For missing emojis, extend the `Emoji` class or create a wrapper. Monitor Spatie’s [GitHub](https://github.com/spatie/emoji) for Unicode updates; manual intervention may be required for future versions.
Are there alternatives to Spatie Emoji for Laravel?
Alternatives include `symfony/mime` (for shortcode-to-Unicode mapping) or `league/emoji` (for dynamic emoji handling). However, Spatie Emoji is Laravel-native, with Blade directives and Eloquent integration, making it the most seamless choice for Laravel apps.
How do I test emoji inputs for security risks (e.g., SQL injection)?
Use Laravel’s built-in validation (`Rule::emoji()`) and Eloquent casting to sanitize inputs. For additional safety, escape emojis in queries or use parameterized statements. The package itself doesn’t handle SQL injection but integrates with Laravel’s security layers.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony