Download the PHP package cocept/filter without Composer

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

Cocept Filter

Cocept Filter is a bundle for Symfony and Doctrine that lets users filter datasets using a select widget.

The bundle provides a service and a widget. The widget shows the user a search input or select box which when changed inserts the appropriate filter options into the URL. The filter service gets the filter options from the URL and adds where clauses to the query builder to filter the results.

Multiple filters can be applied, and operators can also be specified. This bundle plays nicely with KNP Paginator.

Demo Application

You can use this symfony demo application to see the filter bundle in action:

https://github.com/cocept/filter-test

Installation

Install with composer

Load the bundle

Add the bundle to your application kernel:

Apply the filter in your controller

Find the index action of the controller you want to filter and add the following line:

The third parameter should be an array containing a list of regular fields (string, int etc) that the user is allowed to filter.

The fourth parameter should be an array containing a list of foreign key fields that the user is allowed to filter.

Add the widget to your twig template

In your twig template, add the following line:

The first parameter of the filterWidget function should be the field on which to filter.

If the second parameter is omitted, the user will be shown a search field and the ilike operator will be used. Otherwise, an associative array must be provided and the user will see a select box and a button to toggle between the eq and neq operators. The array key will be used as the option label and the value as the option value.

So, if you want to show the user a list of category names, the array would be something like this:

Load the JavaScripts

The filterWidget twig extension uses a javascript file to add the filter options to the URL parameters. Add the following to the head section of your twig template:

Try it out

The widget adds URL parameters like filter_name=someval, where name is the column name and someval is the value to match. You can also add operator_name=neq, where name is the column and neq is the operator to use in the where clause, with the following mappings:

An example URL with filter parameters might be:

http://localhost:8000/post/?filter_category=5&operator_category=neq&filter_name=php&operator_name=ilike

Contributing

This bundle is actively used in production and will be maintained as such. If you wish to submit a pull request it will be promptly considered and merged.


All versions of filter with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
symfony/framework-bundle Version ~2.3|~2.8
twig/twig Version ~1.12|~2
symfony/assetic-bundle Version ^2.7
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 cocept/filter contains the following files

Loading the files please wait ....