Search by

pharaonic / livewire-assistant

Pharaonic

Shared Blade and JavaScript foundation that binds JavaScript widgets to Livewire components.

Package info

github.com/Pharaonic/livewire-assistant

Documentation

Language:JavaScript

pkg:composer/pharaonic/livewire-assistant

Fund package maintenance!

MoamenEltouny

Buy Me A Coffee

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.0 2026-10-22 15:12 UTC

This package is auto-updated.

Last update: 2026-10-22 15:16:38 UTC


README

Livewire Assistant

PHP Version : 8.0 | 8.1 | 8.2 | 8.3 Laravel Version : 7.x | 8.x | 9.x | 10.x Livewire Version : 2.x License Build
Source Packagist Version Packagist Downloads

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.