PHPackages                             milito/query-filter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. milito/query-filter

ActiveLibrary[Database &amp; ORM](/categories/database)

milito/query-filter
===================

This is package to use query filter for each model. This package is made entirely for personal use. But if you are eager to use this, you can easily use this package by using readme. This is very simple and amateur :).

v1.1.1(2y ago)58.8kMITPHPPHP ^8.0|^8.1

Since Nov 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/milito-78/laravel-query-filter)[ Packagist](https://packagist.org/packages/milito/query-filter)[ RSS](/packages/milito-query-filter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/d77b786721d9eadb5b314910fa071b4dba5044e394e20a57577aa42efdd23ae2/68747470733a2f2f706f7365722e707567782e6f72672f6d696c69746f2f71756572792d66696c7465722f76657273696f6e)](https://packagist.org/packages/milito/query-filter)[![Total Downloads](https://camo.githubusercontent.com/7016d32afbb793bfd90469fdf95ba0ed68b4d5e5ddd426c12c50f38dfa22ad41/68747470733a2f2f706f7365722e707567782e6f72672f6d696c69746f2f71756572792d66696c7465722f646f776e6c6f616473)](https://packagist.org/packages/milito/query-filter)[![License](https://camo.githubusercontent.com/0491024ccda38c6bc96630901ea2e67712055589453e041e860645afc373c417/68747470733a2f2f706f7365722e707567782e6f72672f6d696c69746f2f71756572792d66696c7465722f6c6963656e7365)](https://packagist.org/packages/milito/query-filter)

Laravel Query filter package
============================

[](#laravel-query-filter-package)

A simple package for adding your query filter files to project.

Introduction
------------

[](#introduction)

Install the package with composer using the following command:

```
composer require milito/query-filter

```

Usage
-----

[](#usage)

For create new query filter you can run this command in your terminal:

```
php artisan make:query-filter {your-query-filter-name}

```

Example:

```
php artisan make:query-filter ProductsFilter

```

This command will create a `ProductsFilter.php` file in `app/Filters/` path.

This ProductsFilter class, is extended from `QueryFilter` class, and it used for controller functions. And because of that, constructor of this class requires a `request` object.

But if you want to create a filter class with a simple `array` input, you need to use `-a|--array` option after your class name.

```
php artisan make:query-filter ProductsFilter -a

```

This ProductsFilter class, is extended from `ArrayQueryFilter`.

Namespace
---------

[](#namespace)

You can add namespace to your file:

```
php artisan make:query-filter Products/ProductsFilter

```

The above will create a `Products` directory inside the `app/Filters` directory.

How to use!
-----------

[](#how-to-use)

After file generated you should add your functions.
Example:

```
