Download the PHP package ilyasavich/filter without Composer

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

laravel-filter

The filter service for laravel

Installation

To install you just need to require package:

Usage

Create service

First of all you need to extending from Savich\Filter\Kernel class Communication with the service will be provided using this class

Create custom filters

Create class

To create your custom filter you need to extending from Savich\Filter\Contracts\Filter class

Initialize custom filter

In created YourCustomFilter class you necessarily need to implement 3 methods:

Example:

Register your filter

To say to the system about your filter just override the $filters field in your filter kernel and add your custom filter to this array. Example:

Using Filter Trait

If you want to use filter in models you need use Filter trait for it.

Use

To use the system you need to call method make() of the filter kernel class. Example:

In case using filters in models method filter returns instance of Illuminate\Database\Eloquent\Builder so that you can use it in query chains.

What will happen?

By default the method make() will get filters aliases from the url parameters and try to find there in filters that you registered in kernel. If you will pass array of filters in make method it will filtering through this filters Then it will grouping all filters by models namespaces and building query for each group The method make() return array, where keys are models namespaces and values are instances of Illuminate\Database\Eloquent\Builder

Example of works

For example you try to filtering data by this url http://domain.com/url/path?0=filter1&1=filter2%3Aparam1%2Cparam2&2=filter2%3Aparam3 Url parameters have the following representation: ['filter1', 'filter2:param1,param2', 'filter2:param3']

The method make will return associative array:

URL pass parameters

So you need to set in url filters as array, parameters of the filters are optional. Example array got, ['filter1', 'filter2:param1,param2', 'filter2:param3'] Parameters can using, for example, when you need to apply filters on roles in your table users.

You have several filters:

You can set as:

and add there in url. It will be looks like ['role:user', 'role:admin', 'role:publisher']

The system parse each filter and create single class with alias role and will set user, admin and publisher to $parameters array in your custom filter. This is you can see above in there

Some Customizations

Customize Group Name

If you need to customize groups names, you don't want to grouping by whole model namespace, you can make some customization not so much as may you want or need, but still you have some possibilities For it in your filter kernel class override method getGroupName() that passing 1 parameter and it is model namespace

If you have any idea how it can be improved if this is really necessarily send me email.


All versions of filter with dependencies

PHP Build Version
Package Version
Requires illuminate/database Version ^5.2
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 ilyasavich/filter contains the following files

Loading the files please wait ....