Download the PHP package ekramhossain/laravel-query-filter without Composer

On this page you can find all versions of the php package ekramhossain/laravel-query-filter. 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 laravel-query-filter

Laravel Query Filter

A flexible and lightweight query filtering package for Laravel Eloquent with support for:

Requirements

Installation

Install the package via Composer:

The package automatically registers its service provider and Filter facade.

Configuration

Publish the configuration file:

This will publish:

Basic Usage

Suppose you have a Product model:

Basic Filtering

Request:

Equivalent query:

String Filtering

String values are automatically treated as a LIKE search.

Request:

Equivalent query:

Comparison Operators

The following operators are supported:

Operator Meaning
eq Equal
gt Greater than
gte Greater than or equal
lt Less than
lte Less than or equal

Equal

Greater Than

Greater Than Or Equal

Less Than

Less Than Or Equal

Date Range Filtering

Date range filtering is supported using from and to.

Example:

This produces a query equivalent to:

You can use the same syntax with any allowed date column:

Relational Filtering

You can filter records through Eloquent relationships using dot notation.

Example:

Request:

This will use Eloquent's whereHas() internally.

For example:

Nested relationships are also supported:

Sorting

Define allowed sorting columns:

Ascending

Equivalent to:

Descending

Prefix the column with -:

Equivalent to:

Multiple Sorting

Multiple sorting columns can be passed using commas:

Equivalent to:

Multiple Filters

Multiple filters can be combined:

Security

Only fields explicitly defined through allowedFilters() can be filtered.

Only fields defined through allowedSorts() can be sorted.

Unknown filters and sorting fields are ignored.

This prevents users from arbitrarily controlling which database columns are queried.

Complete Example

Example request:

Supported Features

Feature Supported
Basic filtering ✅
String LIKE search ✅
eq ✅
gt ✅
gte ✅
lt ✅
lte ✅
Date range ✅
Relationship filtering ✅
Nested relationship filtering ✅
Ascending sorting ✅
Descending sorting ✅
Multiple sorting ✅
Allowed filters ✅
Allowed sorts ✅

License

This package is open-sourced software licensed under the MIT License.

Author

Md. Ekram Hossain

GitHub: https://github.com/ekrambd/


All versions of laravel-query-filter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/database Version ^9.0|^10.0|^11.0|^12.0
illuminate/http Version ^9.0|^10.0|^11.0|^12.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.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 ekramhossain/laravel-query-filter contains the following files

Loading the files please wait ...