Livewire Packagev1.xMIT License0+ downloads

Assistant: JavaScript widgets that know their component

Livewire Assistant finds every element you mark with data-pharaonic, binds it to the Livewire component that owns it, and runs your integration's mount, update, and cleanup at the right moments, so widgets like Select2 stay in sync with your component without leaks or loops.

$composer require pharaonic/livewire-assistant
Key Features

Everything a widget needs to live inside Livewire

One attribute in Blade, one small object in JavaScript.

Declarative markup

data-pharaonic, data-property, data-component-id, and JSON data-options.

Correct ownership

Elements bind to their nearest component or an explicit id, never to a parent by accident.

Component bridge

get, set, call, and watch, with promises that settle with the real request.

Managed lifecycle

Mount once, update on change, remount on new bindings, clean up on removal and Turbolinks visits.

Observable failures

Stable error codes on a pharaonic:assistant:error event; one broken widget never stops the others.

No Node build

The runtime ships prebuilt and loads with @livewireAssistantScripts, or as an ES module.

A quick look

Register an integration once; every marked element in every component gets its own instance.

resources/js/integrations/select2.js
1Pharaonic.assistant.register('select2', {
2 mount({ element, property, options, component }) {
3 const $element = jQuery(element).select2(options)
4 
5 $element.val(component.get(property) ?? '').trigger('change.select2')
6 $element.on('change.pharaonicAssistant', () => component.set(property, $element.val()))
7 component.watch(property, (value) => $element.val(value ?? '').trigger('change.select2'))
8 
9 return () => $element.off('.pharaonicAssistant').select2('destroy')
10 },
11})
FAQ

Assistant Questions

Quick answers about installing and using Assistant.

What is Assistant?

A shared Blade and JavaScript foundation that binds JavaScript widgets such as Select2 to Livewire components, with correct ownership, two-way sync, and automatic cleanup. It's a free, open-source Livewire package by Pharaonic.

How do I install Assistant?

Run composer require pharaonic/livewire-assistant in your project's root directory, then add @livewireAssistantScripts to your layout.

What does Assistant require?

The latest release requires PHP 7.4+, Laravel 7 – 8 and Livewire 1.

Do I need Node or a build step?

No. The runtime ships prebuilt inside the Composer package and is served by the package. If you bundle your own JavaScript, you can import its ES module build instead.

Does it include Select2 or other widgets?

No. The core contains no widget code. You bring the widget library and a small integration; the documentation includes a complete Select2 integration.

Which Livewire versions are supported?

Each Livewire major has its own release line. The documentation's compatibility page lists the exact Livewire, Laravel, and PHP versions each line is tested with.

Is Assistant free to use?

Yes. Assistant is open source under the MIT license, so you can use it in personal and commercial projects.

Where can I find the Assistant documentation?

Read the Assistant documentation for setup, the integration API, and examples.

How do I report a bug or contribute to Assistant?

Open an issue or a pull request on GitHub, or ask in the Pharaonic Discord.

Ready to dig in?

Read the full documentation for installation, writing integrations, the component bridge, targeting and wire:ignore, load order, the Select2 walkthrough, and diagnostics.