{"id":27698488,"url":"https://github.com/chedim/rest-filter","last_synced_at":"2026-07-13T01:32:19.046Z","repository":{"id":20786404,"uuid":"24071470","full_name":"chedim/rest-filter","owner":"chedim","description":"Class that provides safe conversion of GET-filters to SQL WHERE-CLAUSE for REST-APIs","archived":false,"fork":false,"pushed_at":"2021-10-01T16:52:38.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T09:26:09.950Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chedim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-15T19:56:52.000Z","updated_at":"2022-03-23T02:44:04.000Z","dependencies_parsed_at":"2022-07-23T15:16:23.007Z","dependency_job_id":null,"html_url":"https://github.com/chedim/rest-filter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chedim/rest-filter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chedim%2Frest-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chedim%2Frest-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chedim%2Frest-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chedim%2Frest-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chedim","download_url":"https://codeload.github.com/chedim/rest-filter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chedim%2Frest-filter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35407393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-12T02:00:06.386Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-04-25T16:43:50.033Z","updated_at":"2026-07-13T01:32:19.030Z","avatar_url":"https://github.com/chedim.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"RestFilter\n==========\n\nThis class provides safe conversion of GET-filters to SQL WHERE-CLAUSE\n\n## Usage in code:\n\n```php\n //            table-name, filter, escaping class\n $Filter-\u003einit('items'   , $_GET , $escaper      );\n $whereClause = $filter-\u003egetFilter();\n```\n\n## Usage in GET-queries:\n\nOverall Syntax:\n\n      /items?field:command=argument\n      /items?(field1,field2):command=argument\n      /items?field:command[]=arguments\n      /items?field:command1:command2=argument\n\nExamples: \n\n| Clause: | GET-Query:    | Result SQL:  |\n|---------------|--------------|--------------|\n| Check if field equals to value | /items?id=2 _OR_ /items?id:eq=2  | items.id = 2 |\n| Select all items with id \u003e 2| /items?id:gt=2 | items.id \u003e 2 |\n| Select all items with id that present in list | /items?id[]=1\u0026id[]=2\u0026id[]=4\u0026id[]=6 | items.id IN (1, 2, 4, 6) |\n| Combining several clauses at one filter | /items?id:gt=2\u0026title:like=big | id \u003e 2 AND title LIKE '%big%' | \n| Checking several fields with one clause | /items?(father,son):like=Luke | (items.father LIKE '%Luke%') OR (items.son LIKE '%Luke%') |\n| Checking several clauses at one field | /items?category:null:eq=10 | (items.category IS NULL) OR (items.category = 10) |\n| Checking several clauses at several fields | /items?(id,parent):null:lt=0 | ((items.id IS NULL) OR (items.id \u003c 0)) OR ((items.parent IS NULL) OR (items.parent \u003c 0))\n\n## Available commands: \n\n| Section | Command | Arguments | SQL-equivalent  | \n|-----|---------|------------|----|\n| Comparison: | | | \n| | field:eq= | mixed x | field = x |\n| | field:not= | mixed x | field != x |\n| | field:gt= | mixed x | field \u003e x |\n| | field:lt= | mixed x | field \u003c x |\n| | field:gte= | mixed x | field \u003e= x |\n| | field:lte= | mixed x | field \u003c= x |\n| | field:null= | — | field IS NULL | \n| | field:notnull= | — | field IS NOT NULL |\n| Range: | | | \n| | field:range= | [[a1, a2],[b1,b2],...] | (field BETWEEN a1 AND a2) OR (field BETWEEN b1, b2) OR ...  | \n| | field:notrange= | [[a1, a2],[b1,b2],...] | NOT ((field BETWEEN a1 AND a2) OR (field BETWEEN b1, b2) OR ...)  | \n| Text matching: | | |\n| | field:prefix= | string x | field LIKE 'x%' |\n| | field:like= | string x | field LIKE '%x%' |\n| | field:suffix= | string x | field LIKE '%x' |\n| Set matching: | | | \n| | field:in= | [x1, x2, ...] | field IN (x1, x2, ...) |\n| | field:notin= | [x1, x2, ...] | field NOT IN (x1, x2, ...) |\n| Shortcuts: | | |\n| | field= | x1 | field = x1 |\n| | field= | [x1, x2, ...] | field IN (x1, x2, ...) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchedim%2Frest-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchedim%2Frest-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchedim%2Frest-filter/lists"}