Download the PHP package darxide-pl/cakephp-filter without Composer

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

Filter plugin for CakePHP

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

Intro

In real life applications, filtering queries by user input can quickly growth into enormous queries controlled by tons of inputs.

The main idea of this plugin is keep the code clean and readable.

Every query can have many filters as separated methods in App\Model\Filter namespace, and queries are passed into these filters as parameters, so filters are easy to test and maintain.

Plugin allows you to filtering queries using get variables, post variables, json input.

Plugin has also implemented "memory" of filter in session (optional) and has easily extendable interfaces to help You with write your own implementations.

There are also FilterForm Helper which helps with building forms with filters.

Quick example

  1. cmd: ./bin/cake plugin load Filter
  2. Load helper in /src/View/AppView.php

  3. Use Filter\FilterAwareTrait in Your Table class (notice: this requires the creation of a table or just use existing one) (notice2: Traits needs to declare use inside class declatarion) example file is /src/Model/Table/UsersTable.pgp

  4. Create file named UsersFilter.php in /src/Model/Filter/

  5. Now, we can bind that filter to query in controller and|or paginate this query (in example /src/Controller/PagesController.php)

  6. The last step is html form template. Create /src/Template/Pages/filter_example.ctp file

Docs

1. Use cases

1.1 Filtering same query for different user types

Sometimes we need to disable some fields in filters for different user types.

We can realize that in many ways, and we should consider some possibilities.

We can create separated filter classes for each type of users if filter is complicated and differences between forms for user and admin are huge: /src/Model/Filter/Users/AdminsFilter.php /src/Model/Filter/Users/CustomersFilter.php

Then in controller we can bind expected filter to query as in a quick example.

Notice: Two lines above, we moved filter class one level deeper into a folder tree. The only one difference is argument passed to create FormFilter which should look like this:

or

If difference between user types is small, You can use Session inside filter: In our /src/Model/Filter/UsersFilter.php :

1.2 Get value of one filter method inside another

We can simple realize that by using getter: FilterInterface::get(string $name)

1.3 Access to database inside filter

I think we should avoid that operation, but it happens. Sometimes before filtering we need to fetch some data from database only for preparing the final filtered query.


All versions of cakephp-filter with dependencies

PHP Build Version
Package Version
Requires cakephp/cakephp Version ^3.5
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 darxide-pl/cakephp-filter contains the following files

Loading the files please wait ....