pharaonic / livewire-assistant
Shared Blade and JavaScript foundation that binds JavaScript widgets to Livewire components.
Package info
github.com/Pharaonic/livewire-assistant
Language:JavaScript
pkg:composer/pharaonic/livewire-assistant
Requires
- php: >=8.0 <8.4
- illuminate/http: ^7.30 || ^8.75 || ^9.0 || ^10.0
- illuminate/routing: ^7.30 || ^8.75 || ^9.0 || ^10.0
- illuminate/support: ^7.30 || ^8.75 || ^9.0 || ^10.0
- illuminate/view: ^7.30 || ^8.75 || ^9.0 || ^10.0
- livewire/livewire: ^2.12.7
Requires (Dev)
- laravel/pint: ^1.5
- orchestra/testbench: ^5.20 || ^6.25 || ^7.0 || ^8.0
- pestphp/pest: ^1.23
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^9.6.33
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-22 15:16:38 UTC
README
Bind JavaScript widgets such as Select2 to Livewire components.
Discovery, component ownership, a component bridge, and the mount, update, and cleanup lifecycle.
Installation
composer require pharaonic/livewire-assistant
The service provider is registered automatically. Load the runtime once in your layout, before or after @livewireScripts:
@livewireScripts @livewireAssistantScripts
No Node build is needed. The 2.x line supports Livewire 2.12.7+ on Laravel 7.30+, 8.75+, 9, and 10 with PHP 8.0 to 8.3. For Livewire 1, use the 1.x line.
Laravel 7 to 10 no longer receive security fixes, so recent Composer versions refuse to install or update them until you allow their advisories. The installation guide lists the packages to allow.
Usage
<div wire:ignore> <select data-pharaonic="select2" data-property="country_id"> <option value="">Choose a country</option> <option value="1">Egypt</option> </select> </div>
Pharaonic.assistant.register('select2', { mount({ element, property, options, component }) { const $element = jQuery(element).select2(options) $element.val(component.get(property) ?? '').trigger('change.select2') $element.on('change.pharaonicAssistant', () => component.set(property, $element.val())) component.watch(property, (value) => $element.val(value ?? '').trigger('change.select2')) return () => $element.off('.pharaonicAssistant').select2('destroy') }, })
Load this script after @livewireAssistantScripts, or register through window.PharaonicAssistantQueue so the order does not matter. jQuery and Select2 are your application's dependencies. The documentation has the complete Select2 integration, including loop prevention.
Documentation
Read the full Livewire Assistant documentation for installation, writing integrations, the component bridge, and examples.
Support & Security
See SUPPORT.md and SECURITY.md.
License
MIT. See LICENSE.
