Download the PHP package lara-pack/livewire-select2 without Composer

On this page you can find all versions of the php package lara-pack/livewire-select2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package livewire-select2

Livewire Select2 Component

A custom Livewire V3/V4 component wrapper for Select2. This component simplifies the usage of Select2 in your Livewire projects, supporting both static options arrays and AJAX-based remote data loading, along with multiple selections capabilities.

Requirements

Installation

You can install the package via composer:

Note: Ensure you have already included jQuery and Select2 assets in your layout file/app.

Usage

You can use the component in your Livewire blade views using the <livewire:... /> tag.

1. Basic Usage (Static Options)

Provide an array of arrays containing id and text keys.

2. AJAX Remote Data (Load from API / URL)

Instead of passing static options, you can provide an endpoint URL. The component will handle the AJAX calls and debounce internally.

The API should return an array of objects structured as [{ "id": 1, "text": "Option 1" }, ...].

3. Multiple Selections

Enable multiple selection mode by passing :multiple="true".

4. Custom "Select All Filtered" for Multiple AJAX

This component comes with a special feature for AJAX Multiple Select. If you pass :multipleSelection="true", an extra option "--- Pilih Semua Yang Tampil ---" will appear at the top. Selecting it will fetch and select all data matching the search term.

Available Properties

Property Type Default Description
wire:model string null Bind the selected value. Must be { "id": ..., "text": ... } for single select, or an array of objects for multiple.
options array [] Static array of options: [['id'=>1, 'text'=>'Opt']].
url string "" The API Endpoint for AJAX data loading.
minimumInputLength int 0 Number of characters required to trigger the search.
placeholder string "" Placeholder text for the input.
allowClear bool true Show a clear button (X) to reset the value.
dropdownParent string "" Appends the dropdown to a specific element. Very useful inside Bootstrap Modals (e.g., '#myModal').
debounceTime int 500 Delay in milliseconds before firing the AJAX request.
class string '' Extra CSS classes injected directly to the <select> element.
theme string '' Select2 theme (e.g., 'bootstrap-5').
multiple bool false Set to true to allow arrays of selections.
multipleSelection bool false When true in AJAX multiple mode, allows selecting all loaded search results at once.
disabled bool false Disables the Select2 input entirely.

Data Binding & Format

Because Livewire components pass data over the wire, the bound value representation is always an object or an array of objects, representing the selected id and text.

For single selection:

For multiple selections:

Troubleshooting: Modals

If your Select2 input isn't clickable or doesn't show properly inside a Bootstrap Modal, you need to set the dropdownParent property to target your modal element.

License

This package is distributed under the MIT license.


All versions of livewire-select2 with dependencies

PHP Build Version
Package Version
Requires livewire/livewire Version ^3.0|^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lara-pack/livewire-select2 contains the following files

Loading the files please wait ...