Download the PHP package obrainwave/laravel-query-filters without Composer

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

Laravel Query Filters

A lightweight Laravel package for advanced Eloquent filtering, including global search, relationship filtering, operators, pagination, sorting, and custom filter classes.


Installation

Publish the config (optional):


Configuration

All defaults are in config/query-filters.php:


Basic Usage

You can filter Eloquent models directly using the filter() scope.

To use the query filters in your Laravel models, you must add the Filterable trait to the model. For example:

Once the trait is added, you can call the filter() method on your model statically:

If you know what you are doing, you can probably just leave $allowedFilters as public property

Or you can actually allow all table columns to be filtered by setting the default value in config/query-filters.php

And also supports laravel paginate and simplePaginate

URL Parameters

Filters also work directly from URL query parameters:

Which you can pass directly from your request helper or injected Illuminate\Http\Request


Using Laravel Query Methods

After applying filters with the package, you can continue to use all standard Laravel query builder and Eloquent methods. For example:

This allows you to combine filtering with any Laravel query workflow seamlessly.


Features

1. Global Search

Search across multiple columns using a single query parameter:

Customize global search columns in your model:

Or provide a method:


2. Allowed Filters

Only specified filters are applied:

You can also set global defaults in the config.


3. Operators

Filter with operators like gt, gte, lt, lte, between, and like:


4. Relationship Filtering

Filter nested relationships using dot notation:

It also supports relationship filtering and can accept arrays of values. This allows you to filter related models based on multiple possible values. For example:


5. Sorting

Sort using query string or programmatically:


6. Pagination

Pagination works out-of-the-box with per-page overrides:

OR


7. Custom Filter Classes

If you need full control, generate a filter class and handle your custom logic in it:

The auto method automatically generates filters for your model. It uses either the model’s database columns or the columns you specify in the config, so you can quickly enable filtering without defining each field manually.

Example UserFilter:

Then use automatically by chaining your class method(s) to your model:


8. Chaining

The filter returns a query builder proxy, so you can chain additional methods from your Custom Filter Class:


9. Case-insensitive Filtering

By default, filters are case-insensitive (exact or like) except when configured otherwise (strict).


10. Extending & Customization


Example: Full Feature Usage


Installation Notes


License

MIT License.


Contributing

We welcome contributions from everyone! If you have ideas, bug fixes, or improvements, feel free to open an issue or submit a pull request. Whether it’s enhancing filters, adding new features, or improving documentation, your contributions are highly appreciated.


All versions of laravel-query-filters with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
spatie/laravel-package-tools Version ^1.16
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 obrainwave/laravel-query-filters contains the following files

Loading the files please wait ...