WireSelect

Creator & Lead Developerยท
Open Source
ยท2025
Laravel
Livewire
PHP
Blade
WireSelect

WireSelect ๐Ÿš€

Integrating Select2 with Livewire has historically been a headache for many developers. Between tricky wire:ignore implementations, broken validation states, and complex modal behaviors, it often feels like more trouble than it's worth.

WireSelect was born to solve these exact frustrations. It is a high-performance, native Livewire component that provides a seamless searchable select experience without any jQuery dependencies or hacky workarounds.

Why Choose WireSelect? ๐ŸŽฏ

  • Native Livewire: No more wire:ignore. It works perfectly with Livewire's lifecycle and state management.
  • Database Search: Lightning-fast live search directly from your database tables.
  • Zero jQuery: Built with modern Laravel and Livewire standards, eliminating heavy legacy dependencies.
  • Instant Validation: Works with standard Livewire validation rules out of the box.
  • Flexible Data: Supports both dynamic database queries and static array data.

Quick Start (Installation) ๐Ÿ“ฆ

Getting started takes less than 2 minutes. Install via Composer:

composer require fyyyn1210/wire-select

Basic Usage Example ๐Ÿ’ก

Simply drop the component into your Blade template and specify your table and field:

<livewire:wire-select-box table-name="users" field-name="user_id" label="Select User" />

Advanced Database Search

<livewire:wire-select-box table-name="products" search-column="name" key-column="id" value-column="name" field-name="product_id" label="Search Products" :condition="['status' => 'active']" placeholder="Type to search active products..." />

Comparisons: Before vs. After ๐Ÿ› ๏ธ

Before (Classic Select2 + jQuery)

  • 60+ lines of code (HTML + complex JavaScript AJAX setup).
  • Issues with DOM diffing and state synchronization.
  • Manual event handling to update Livewire state.

After (WireSelect)

  • 2 lines of code (Native Blade component).
  • No JavaScript required for setup.
  • Automatic state management and synchronization.

Join the Community ๐Ÿค

WireSelect is an open-source project aimed at improving the Laravel Livewire developer experience. It is used in numerous production projects and is constantly evolving.

Feel free to contribute, report bugs, or suggest features on GitHub.

โญ Star us on GitHub if this package saved you from a Select2 headache!

GitHub
LinkedIn