Download the PHP package contenir/contenir-db-queryfilter without Composer
On this page you can find all versions of the php package contenir/contenir-db-queryfilter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package contenir-db-queryfilter
contenir/contenir-db-queryfilter
Filterable, paginated php-db queries driven by a search form, for Contenir CMS and any Laminas MVC or Mezzio application.
You describe each query parameter once, as a filter class. The filter
supplies its form element and input validation, and changes the SQL
Select according to the submitted value. A query filter reads the
request through the form, applies every filter to a table's select, and
hands back a Laminas Paginator adapter, or prev/next navigation around a
record. A contenir-db-model 2
repository can be the table directly, so pages are hydrated entities.
- Text, select, radio, hidden and immutable filter types
- Form elements and input filters generated from the filters
- Laminas Paginator adapter that fetches pages through your table or repository
- Before/after hooks for tenant isolation, soft deletes and similar
- Previous/next navigation within the filtered result (MySQL)
- Works with any table implementing
QueryFilterTableInterface(createSelect()andfetch()), including contenir-db-model 2 repositories queryFilter()controller plugin for Laminas MVC
Requirements
- PHP 8.3, 8.4 or 8.5
- php-db/phpdb 0.6, laminas/laminas-form ^3.20, laminas/laminas-paginator ^2.18, laminas/laminas-servicemanager ^3.22
- A php-db platform package for your database (php-db/phpdb-mysql, php-db/phpdb-sqlite, ...)
- laminas/laminas-mvc, only for the controller plugin
The 1.x releases, built on laminas-db and supporting PHP 8.1, remain
available from the 1.x branch; see UPGRADE-2.0.md.
Install
laminas-component-installer registers the ConfigProvider (Mezzio) or the
Contenir\Db\QueryFilter module (Laminas MVC). See
framework integration to do it
by hand.
Usage
1. Filters
2. A form built from the filters
3. Filter and paginate
With contenir-db-model 2 the repository needs no extra code, and the paginator yields entities:
A plain repository works too, wrapped in RepositoryTable:
See Tables for other table gateways.
In a Laminas MVC controller, $this->queryFilter(QueryFilter::class) builds
the query filter from the service manager instead.
Public API
| Class | Role | Reference |
|---|---|---|
Filter\AbstractFilter, AbstractFilterText, AbstractFilterSelect, AbstractFilterRadio, AbstractFilterHidden, AbstractFilterImmutable, FilterTrait |
Filter types and their shared properties and helpers | Filters |
FilterSet |
Ordered filters plus input values | Filters |
AbstractForm, Form |
Laminas form built from a filter set | Forms |
QueryFilterInterface, AbstractQueryFilter, QueryFilter |
Request handling, pagination, hooks, prev/next navigation | Query filters |
QueryFilterTableInterface |
What a table or repository provides: createSelect(), fetch() |
Query filters |
RepositoryTable |
Adapts any contenir-db-model 2 Repository to the interface (needs contenir-db-model) |
Query filters |
Paginator\SelectAdapter |
Laminas Paginator adapter returned by getPagingResultSet() |
Query filters |
ConfigProvider, Module, Controller\Plugin\QueryFilterPlugin, Controller\Plugin\QueryFilterPluginFactory |
Configuration and the MVC controller plugin | Framework integration |
Configuration
The package has no configuration keys. Its ConfigProvider and Module
register the queryFilter controller plugin (aliases queryFilter and
QueryFilter) under controller_plugins. Query filters built by the plugin
must be registered with your service manager; see
the plugin.
Development
The QA toolchain is php-db/phpdb-qa-tools.
Mago is a standalone binary, installed
separately (brew install mago).
License
BSD-3-Clause. See LICENSE.md.
All versions of contenir-db-queryfilter with dependencies
laminas/laminas-db Version ^2.0
laminas/laminas-form Version ^3.20
laminas/laminas-paginator-adapter-laminasdb Version ^1.4.0