Download the PHP package holoyan/eloquent-filter without Composer

On this page you can find all versions of the php package holoyan/eloquent-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 eloquent-filter

Eloquent Filter

Table of Content

Requirement

PHP >= 7.1

Installation

composer require holoyan/eloquent-filter

Basic Usage

Let's say we want to return a list of users filtered by multiple parameters. For example this is our request url: /users?email=jo&categories[]=3&categories[]=4&role=admin

$request->all() will return:

To filter by all those parameters we can simply write

In our User model we must import Filterable trait

then create class called UserFilter in App\Http\Filters folder

Query returns all users whose name starts with jo, belongs to category 3 or 4 and have role admin.

By default, package will look for filter class in App\Http\Filters folder with name ModelFilter, but if you want ypu can customize this behavior.

add $filterClass static property in model.

Dynamic filter

Sometimes you may want to use a dynamic filter depending on conditions. In this case you can pass second argument to filter method which is the filter class:

Customize column

You can also customize your column name

Customize value

Available filters

if you want to use like comparison type you can use one of those methods:

Ordering

To order result use OrderRule rule

Relation filter

Suppose User has Product relation, and we want to return all users which have product which name starts with 'cook'

This allows you recursively pass any rules you want

Nested filter

To make nested filter we need to use NestedRule::class

Extending filter

You can create your custom rules with custom logic

Custom Rules

For creating custom rules all you need is to create you class extend from use holoyan\EloquentFilter\Rules\FilterRule class and implement handlemethod

Thats all, now you can use custom rule;

Credits

Inspired by and-m-a

License

MIT


All versions of eloquent-filter with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
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 holoyan/eloquent-filter contains the following files

Loading the files please wait ....