Package Development
Use the Emoji service when another Laravel package needs Corepine Emoji defaults without hardcoding config keys.
Facade
use Corepine\Emoji\Facades\Emoji;
$theme = Emoji::theme();
$columns = Emoji::columns();
$quickReactions = Emoji::quickReactions();
$recentKey = Emoji::recentStorageKey();
$reactionKey = Emoji::reactionStorageKey();
$selectedEvent = Emoji::event()->selected();
$reactionSelectedEvent = Emoji::event()->reactionSelected();
$colors = Emoji::colors();
The facade reads from config/corepine-emoji.php, so host applications can publish the config once and every package sees the same values.
Dependency Injection
Type-hint the service when package code should be easier to test:
use Corepine\Emoji\Emoji;
class CommentComposer
{
public function __construct(
protected Emoji $emoji,
) {
}
public function defaults(): array
{
return [
'theme' => $this->emoji->theme(),
'columns' => $this->emoji->columns(),
'quick_reactions' => $this->emoji->quickReactions(),
'selected_event' => $this->emoji->event()->selected(),
'reaction_selected_event' => $this->emoji->event()->reactionSelected(),
];
}
}
Config Access
Use named methods for common values:
Emoji::locale();
Emoji::theme();
Emoji::color();
Emoji::columns();
Emoji::recentLimit();
Emoji::quickReactions();
Emoji::recentStorageKey();
Emoji::reactionStorageKey();
Emoji::selectedEvent();
Emoji::reactionSelectedEvent();
Use config() for uncommon values:
Emoji::config('storage.recent');
Emoji::config('storage.reactions');
Emoji::config('events.dispatch.selected');
Event Names
Use the event helper when package JavaScript or Blade views need to listen for picker events:
use Corepine\Emoji\Facades\Emoji;
$selectedEvent = Emoji::event()->selected();
$reactionSelectedEvent = Emoji::event()->reactionSelected();
These resolve the active names from config/corepine-emoji.php, including app-level overrides:
'events' => [
'dispatch' => [
'selected' => 'emoji.selected',
'reaction_selected' => 'emoji.reaction-selected',
],
],
Emoji Metadata
Read generated Emojibase metadata from the service:
$categories = Emoji::categories();
$emojis = Emoji::emojis();
Each category contains a key, label, icon, and emojis array. Each emoji item contains emoji, label, and tags.
Blade In Package Views
Package views can render the public components directly:
<textarea id="message"></textarea>
<x-corepine.emoji target="message" />
For a docked composer, render the picker inline:
<x-corepine.emoji
:trigger="false"
target="message"
class="h-[420px] w-full rounded-xl"
/>
Component details: Blade Components