Download the PHP package bakhadyrovf/easy-filter without Composer

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

Easy Query Filter

This is a package that filter queries with user's custom methods.

Dependencies

Installation

Laravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Copy the package config to your local config with the publish command.

Usage

Important:

The namespace for filters by default App\Filters and each filter class before creating expects that you already have Eloquent Model with the namespace standards as follows: Filter Model
App\Filters\UserFilter App\Models\User
App\Filters\Dashboard\ArticleFilter App\Models\Dashboard\Article
App\EloquentFilters\TagFilter App\Models\Tag

First of all you must create filter class:

This command creates ArticleFilter class in your project's app/Filters folder.
Also this command adds trait Filterable to your Eloquent Model.

You can change base folder's name in your config file (Namespace will be changed as well):

Also, you can generate a filter class with subfolder:

Filter class will be located in app/Filters/Dashboard folder.

The newly created class will looks like this:

If the namespace of your Model or Filter does not match the above, you can use --model option: For example - we have model with namespace App\Models\Article, we want to create a filter class with namespace App\Filters\Dashboard\ArticleFilter:

In order for a filter that does not match the namespace with the model, you must add method on your App\Models\Article class:

This method will point to a specific filter class.

Now, you can write your methods inside filter class. Let's add first method and try to filter our query. In app/Filters/ArticleFilter:

Method Arguments

And you can try to filter query using filter() method on your Eloquent Model. This method is basic Eloquent Scope so you can use it as usually. In app\Http\Controllers\ArticleController:

All parameters that are responsible for filtering must be in query:

If your parameter is in snake case, you don't need to create a method with the same case, because it doesn't match php standards. The package itself converts the parameter to camel case.

For example if your parameter is first_name:

Method will be looks like this:

Multiple values
If your parameter can take multiple values, you can use brackets:

As usual, these values will be in the method's second argument

Ignoring parameters
For example if you want to ignore post_ids parameter from filtering:

You can provide exceptions array of method names or query parameters as an argument to filter() method:

Multiple filters
If you have multiple filter classes for one model, you can provide specific filter class as a second argument. This filter class will be used even if you have a provideFilter() method on the model:


All versions of easy-filter with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 bakhadyrovf/easy-filter contains the following files

Loading the files please wait ....