{"id":29543184,"url":"https://github.com/api-skeletons/zf-doctrine-criteria","last_synced_at":"2026-03-05T09:01:35.130Z","repository":{"id":56949303,"uuid":"136243081","full_name":"API-Skeletons/zf-doctrine-criteria","owner":"API-Skeletons","description":"Build criteria for filtering collections from array parameters","archived":false,"fork":false,"pushed_at":"2018-07-03T01:13:16.000Z","size":58,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-27T13:53:13.971Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/API-Skeletons.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-05T22:48:54.000Z","updated_at":"2021-12-16T02:17:27.000Z","dependencies_parsed_at":"2022-08-21T07:20:52.886Z","dependency_job_id":null,"html_url":"https://github.com/API-Skeletons/zf-doctrine-criteria","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/API-Skeletons/zf-doctrine-criteria","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/API-Skeletons%2Fzf-doctrine-criteria","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/API-Skeletons%2Fzf-doctrine-criteria/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/API-Skeletons%2Fzf-doctrine-criteria/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/API-Skeletons%2Fzf-doctrine-criteria/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/API-Skeletons","download_url":"https://codeload.github.com/API-Skeletons/zf-doctrine-criteria/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/API-Skeletons%2Fzf-doctrine-criteria/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30117477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T08:19:04.902Z","status":"ssl_error","status_checked_at":"2026-03-05T08:17:37.148Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-17T13:08:44.451Z","updated_at":"2026-03-05T09:01:35.088Z","avatar_url":"https://github.com/API-Skeletons.png","language":"PHP","funding_links":["https://www.patreon.com/apiskeletons"],"categories":[],"sub_categories":[],"readme":"ZF Doctrine Criteria\n====================\n\n[![Build Status](https://travis-ci.org/API-Skeletons/zf-doctrine-criteria.svg?branch=master)](https://travis-ci.org/API-Skeletons/zf-doctrine-criteria)\n[![Coverage](https://coveralls.io/repos/github/API-Skeletons/zf-doctrine-criteria/badge.svg?branch=master\u0026123)](https://coveralls.io/repos/github/API-Skeletons/zf-doctrine-criteria/badge.svg?branch=master\u0026123)\n[![Gitter](https://badges.gitter.im/api-skeletons/open-source.svg)](https://gitter.im/api-skeletons/open-source)\n[![Patreon](https://img.shields.io/badge/patreon-donate-yellow.svg)](https://www.patreon.com/apiskeletons)\n[![Total Downloads](https://poser.pugx.org/api-skeletons/zf-doctrine-criteria/downloads)](https://packagist.org/packages/api-skeletons/zf-doctrine-criteria)\n\nThis library builds a Criteria object from array parameters for use in filtering collections.\n\n\nInstallation\n------------\n\nInstallation of this module uses composer. For composer documentation, please refer to\n[getcomposer.org](http://getcomposer.org/).\n\n```bash\n$ composer require api-skeletons/zf-doctrine-criteria\n```\n\nOnce installed, add `ZF\\Doctrine\\Criteria` to your list of modules inside\n`config/application.config.php` or `config/modules.config.php`.\n\n\u003e ### zf-component-installer\n\u003e\n\u003e If you use [zf-component-installer](https://github.com/zendframework/zf-component-installer),\n\u003e that plugin will install zf-doctrine-criteria as a module for you.\n\n\nConfiguring the Module\n----------------------\n\nCopy `config/zf-doctrine-criteria.global.php.dist` to `config/autoload/zf-doctrine-criteria.global.php`\nand edit the list of aliases for those you want enabled.  By default all supported expressions are enabled.\n\n\u003e Note AND and OR composite expressions are not supported yet.\n\n\nUse\n---\n\n```php\nuse Doctrine\\Common\\Util\\ClassUtils;\nuse ZF\\Doctrine\\Criteria\\Builder as CriteriaBuilder;\n\n$filterArray = [\n    [\n        'type' =\u003e 'eq',\n        'field' =\u003e 'name',\n        'value' =\u003e 'Grateful Dead',\n    ],\n    [\n        'type' =\u003e 'beginswith',\n        'field' =\u003e 'state',\n        'value' =\u003e 'UT',\n    ],\n];\n\n$orderByArray = [\n    [\n        'type' =\u003e 'field',\n        'field' =\u003e 'venue',\n        'direction' =\u003e 'asc',\n    ]\n];\n\n$criteriaBuilder = $container-\u003eget(CriteriaBuilder::class);\n$entityClassName = ClassUtils::getRealClass(get_class($collection-\u003efirst()));\n$metadata = $objectManager-\u003egetClassMetadata($entityClassName);\n$criteria = $criteriaBuilder-\u003ecreate($metadata, $filterArray, $orderByArray);\n\n$filteredCollection = $collection-\u003ematching($criteria);\n```\n\n\nFilters\n-------\n\nFilters are not simple key/value pairs. Filters are a key-less array of filter definitions.\nEach filter definition is an array and the array values vary for each filter type.\n\nEach filter definition requires at a minimum a 'type'.\nA type references the configuration key such as 'eq', 'neq', 'contains'.\n\nEach filter definition requires at a minimum a 'field'. This is the name of a field on the target entity.\n\nEach filter definition may specify 'where' with values of either 'and', 'or'.\n\n\nFormat of Date Fields\n---------------------\n\nWhen a date field is involved in a filter you may specify the format of the date using PHP date\nformatting options. The default date format is ISO 8601 `Y-m-d\\TH:i:sP` If you have a date field which is\njust `Y-m-d` then add the format to the filter. For complete date format options see\n[DateTime::createFromFormat](http://php.net/manual/en/datetime.createfromformat.php)\n\n```php\n[\n    'format' =\u003e 'Y-m-d',\n    'value' =\u003e '2014-02-04',\n]\n```\n\n\nIncluded Filter Types\n---------------------\n\nEquals:\n\n\u003e Doctrine Collections does not currently support DateTime `Equals` comparisons.\n\u003e Any DateTime values sent through the `equals` filter will always return not equals.\n\u003e This is a shortcoming of [doctrine/collections](https://github.com/doctrine/collections)\n\u003e and not this module.  Other comparison operators should work as expected.\n\n```php\n['type' =\u003e 'eq', 'field' =\u003e 'fieldName', 'value' =\u003e 'matchValue']\n```\n\nNot Equals:\n\n```php\n['type' =\u003e 'neq', 'field' =\u003e 'fieldName', 'value' =\u003e 'matchValue']\n```\n\nLess Than:\n\n```php\n['type' =\u003e 'lt', 'field' =\u003e 'fieldName', 'value' =\u003e 'matchValue']\n```\n\nLess Than or Equals:\n\n```php\n['type' =\u003e 'lte', 'field' =\u003e 'fieldName', 'value' =\u003e 'matchValue']\n```\n\nGreater Than:\n\n```php\n['type' =\u003e 'gt', 'field' =\u003e 'fieldName', 'value' =\u003e 'matchValue']\n```\n\nGreater Than or Equals:\n\n```php\n['type' =\u003e 'gte', 'field' =\u003e 'fieldName', 'value' =\u003e 'matchValue']\n```\n\nContains:\n\n\u003e Used to search inside of a string.  Comlimentary with Starts With \u0026 Ends With,\n\u003e contains matches a string inside any part of the value.\n\n```php\n['type' =\u003e 'contains', 'field' =\u003e 'fieldName', 'value' =\u003e 'matchValue']\n```\n\nStarts With:\n\n```php\n['type' =\u003e 'startswith', 'field' =\u003e 'fieldName', 'value' =\u003e 'matchValue']\n```\n\nEnds With:\n\n```php\n['type' =\u003e 'endswith', 'field' =\u003e 'fieldName', 'value' =\u003e 'matchValue']\n```\n\nMember Of:\n\n\u003e Used to search inside an array field to match the matchValue to an array element.\n\n```php\n['type' =\u003e 'memeberof', 'field' =\u003e 'fieldName', 'value' =\u003e 'matchValue']\n```\n\nIn:\n\n\u003e Note: Dates in the In and NotIn filters are not handled as dates.\n\u003e It is recommended you use other filters instead of these filters for date datatypes.\n\n```php\n['type' =\u003e 'in', 'field' =\u003e 'fieldName', 'values' =\u003e [1, 2, 3]]\n```\n\nNotIn:\n\n\u003e Note: Dates in the In and NotIn filters are not handled as dates.\n\u003e It is recommended you use other filters instead of these filters for date datatypes.\n\n```php\n['type' =\u003e 'notin', 'field' =\u003e 'fieldName', 'values' =\u003e [1, 2, 3]]\n```\n\n\nOrderBy\n-------\n\nField:\n\n```php\n['type' =\u003e 'field', 'field' =\u003e 'fieldName', 'direction' =\u003e 'desc']\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapi-skeletons%2Fzf-doctrine-criteria","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapi-skeletons%2Fzf-doctrine-criteria","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapi-skeletons%2Fzf-doctrine-criteria/lists"}