Download the PHP package emmadonjo/laravel-filter without Composer
On this page you can find all versions of the php package emmadonjo/laravel-filter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download emmadonjo/laravel-filter
More information about emmadonjo/laravel-filter
Files in emmadonjo/laravel-filter
Package laravel-filter
Short Description A laravel package to easily add filtering to your eloquent queries
License MIT
Informations about the package laravel-filter
Laravel Filter is a laravel package to easily add filtering and search capabilities to your eloquent queries.
Installation
Install via composer:
Usage
Filtering
You can:
- Filter single or multiple columns
- Filter columns with list (array) of possible values
To filter,
- use the
HasFiltertrait - define a
filterableColumns()method that returns an array of columns that can be filtered - optionally, implement
Filterableinterface - in your queries, use the
filter($filters)method to filter records
Searching
To search,
- use the
HasSearchtrait - define a
searchableColumns()method that returns an array of columns that can be searched - optionally, implement
Searchbleinterface - in your queries, use the
search($searchTerm)method to search records
Performance
-
For large records or columns with large values, it's advisable to use a service/package that supports fulltext search, for example, Elasticsearch.
- Indexing searching columns (where necessary) will help improve performance, but this should be carefully done.
Filtering and Searching
To filter & search,
- use the
HasFilterandHasSearchtraits - define a
filterableColumns()andsearchableColumnsmethods that return arrays of columns that can be filtered or searched respectively - optionally, implement
Filterableand, orSearchableinterfaces - in your queries, use the
filter($filters)andsearch($searchTerm)methods to filter and search records
Changelog
Kindly see the releases for more information on what has changed recently.
Contributing
Pull requests are highly welcomed. Ensure you follow the PSR coding standards and meet static analysis level of 9.
License
The MIT License (MIT). Please see LICENSE for details.