Download the PHP package daguilarm/livewire-combobox without Composer

On this page you can find all versions of the php package daguilarm/livewire-combobox. 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-combobox

Package Logo

Latest Version on Packagist StyleCI GitHub last commit

Livewire Combobox: A dynamic selects for Laravel Livewire

A Laravel Livewire multiple selects depending on each other values, with infinite levels of dependency and totally configurable.

Requirements

This package need at least:

Installation

You can install the package via composer:

composer require daguilarm/livewire-combobox

Add the package styles in the <head> using the helper @LivewireComboboxCss:

Documentation

General Methods

The first thing you have to do is create a component in your folder Livewire. Below you can see an example using three selects:

The package supports infinite dependent elements. The method elements() should return an array with all the elements.

Let's see how the class works Select::class and its methods:

make()

The method make(), has the following structure:

model()

As it can be seen, the attribute $model is optional in the make() method, and it can be added using the method model():

:warning: Defining the model is mandatory, but it can be done in the two ways described.

uriKey()

This method is mandatory, it is used to define a unique key for the element.

hideOnEmpty()

Dependent children are removed if they are empty, instead of showing an empty field.

withoutResponse()

When we want an element does not send a response to the component and works only as a form field, that is, remove all the Laravel Livewire code from it. Very useful when it comes to the last selectable element and we don't want to send a request to the server.

Child elements

These elements have their own methods, apart from those described above. These child elements do not need the method options(), although it can be added if desired. The child specific methods are described below:

dependOn()

With this method we define the parent element on which our child element depends. We must use the uriKey from the parent element. The basic structure of the method is:

As can be seen, it admits a second value which is the foreing key that links the two models: Parent and Child.

foreignKey()

This second field can also be added in two ways:

selectRows()

It is used to select the fields from the table that we want to load in the child element.

disabledOnEmpty()

If you want to disabled the field while it is empty...

Field Types

At the moment, the package support the folowing field types:

Select field

These fields have the following methods:

options()

It is used to add the values ​​that will be shown in the element select. We can directly add an array with the values, or define a callback. The two values ​​returned by the array: key and value, are shown as follows in the Blade template:

Therefore, in the component example (will be reverse):

firstRemoved()

By default, each item will show a select field with an empty option element:

If you want to remove it, you can add the method firstRemoved().

Search field

comming soon...

Loading...

You can activate or deactivate the loading state, modifying the attribute $loading, in your component:

By default it is activated (true). The template file is located at: resources/views/vendor/livewire-combobox/loading.blade.php.

Customize the display of elements

The package uses TailwindCSS so the styles must be based on it. The structure of the elements is as follows:

We can modify the styles of the Main Container from the component that we created at the beginning of the documentation, using the $comboboxContainerClass:

To modify an element, we will have to do it directly from each of them, using the method class():

We can use the new functionality of php 8 to modify only those parts that interest us, or we can use the method directly:

The order of the parameters is:

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of livewire-combobox with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
livewire/livewire Version ^2.3
mattlibera/livewire-flash Version ^0.5.0
spatie/laravel-package-tools Version ^1.6
symfony/http-kernel Version ^5.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 daguilarm/livewire-combobox contains the following files

Loading the files please wait ....