Download the PHP package petrelli/search-interface-builder without Composer

On this page you can find all versions of the php package petrelli/search-interface-builder. 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 search-interface-builder

Search Interface Builder

Build and maintain filters for your listings.

Everything will be automatically managed. URL's, Values, Labels, etc. by just defining a few classes.

Live Example

Please visit here and click around.

The complete view for this example is a just few lines:

The entire logic to build all URL's is managed automatically by our Sections and Filters classes.

Performing an actual search

The way an actual search is triggered on your data sources is entirely up to you.

This package will provide you with a simple and flexible way to build your filters and sorters, but connecting the generated URL's will depend on your application.

Executing scopes

To close this gap, I recommend using the Scoped Controller package.

It's solely functionality is to execute scopes over your query builders depending on your URL's, which makes it a perfect fit.

Your controllers and views will always be decluttered this way.

Installation

Include it in your composer.json file calling

Or add:

And run composer update.

Service provider

Only if you have disabled Laravel's auto-discover, you'll have to manually add the service provider to your config/app.php file.

Important Concepts

Section

A section is a collection of filters and/or a sorter. You can define as many sections as you want.

Filter

A Filter is a specific category to filter your collection (for example, Department and Location on the previous image).

You can reutilize filters across your sections.

Directory structure

By default everything will be located under App/Filters.

Usage

1. Create a new empty Section.

This will generate a new Section class inside App\Filters\Sections.

If you don't specify a route please open the generated file and update it.

2.1 Create Filters

This will generate a new Filter class inside App\Filters\Definitions.

Here you can adjust 3 things:

Optional:

2.2 Create a Sorter (optional)

A sorter is actually a filter, so the step to create it is the same as 2.1.

The only difference is that we should only allow one selected option at a time.

To acomplish this you have to inherit from SingleSelector instead of a MultipleSelector.

3. Add those filters to the section

The following example Section contains two filters (Department and Location), and a sorter (SortStaff).

4. Use the Section object in your view

From the controller we send the object to the view:

And from them we can print everything in our views.

Usage: Print filter titles

Used to print the names of each filter to build the top section:

Usage: Print all filter options

Here we print each one of the options:

Each option object contains the following attributes:

For 99% of use cases you will only have to use url, active, and label.

Usage: Print a list with the selected filters

As you will see at the live example after selecting a few filters, that list can be automatically generated.

This list will include all selected options within all filters.

Usage: Create a filter that allows only one selected element

To acomplish this you have to inherit from SingleSelector instead of MultipleSelector.

Usage: Build a custom route for a specific filter

Just overload the buildRoute function inside your filter class.

TODO

License

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


All versions of search-interface-builder with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
laravel/framework Version ~5.6|~5.7|~5.8|^6.0|^7.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 petrelli/search-interface-builder contains the following files

Loading the files please wait ....