{"id":16676870,"url":"https://github.com/aidan-casey/http-parser","last_synced_at":"2026-04-27T06:31:56.796Z","repository":{"id":56942632,"uuid":"147255048","full_name":"aidan-casey/http-parser","owner":"aidan-casey","description":"Various tools for parsing HTTP requests into API usable queries.","archived":false,"fork":false,"pushed_at":"2018-09-10T14:54:04.000Z","size":20,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-30T13:15:05.123Z","etag":null,"topics":["api","database","psr-7","slimframework","zend-db","zend-framework"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aidan-casey.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-03T21:25:20.000Z","updated_at":"2024-09-13T22:31:52.000Z","dependencies_parsed_at":"2022-08-21T07:50:29.271Z","dependency_job_id":null,"html_url":"https://github.com/aidan-casey/http-parser","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/aidan-casey/http-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidan-casey%2Fhttp-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidan-casey%2Fhttp-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidan-casey%2Fhttp-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidan-casey%2Fhttp-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aidan-casey","download_url":"https://codeload.github.com/aidan-casey/http-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidan-casey%2Fhttp-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32325830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"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":["api","database","psr-7","slimframework","zend-db","zend-framework"],"created_at":"2024-10-12T13:11:50.989Z","updated_at":"2026-04-27T06:31:56.759Z","avatar_url":"https://github.com/aidan-casey.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"This package provides various classes that help convert a PSR representation of an HTTP request into other forms useful for an API server.\n\nFor example, the ``HttpToZend`` class will convert HTTP parameters into a database query that can be passed to your model for serving up information or carrying out actions.\n\n# Install\nComing soon! For now, feel free to clone this repository.\n\n# HttpToZend\n\n## Supported GET Parameters / request methods\n|Parameter|Request Method|Value|\n|--|--|--|\n|fields|SELECT|String|\n|filter|DELETE, SELECT, PATCH, PUT|JSON|\n|orderby|SELECT|JSON|\n|limit|SELECT|Integer|\n|offset|SELECT|Integer|\n\n### Fields\n```fields=ID, Name```\n\n### Filter\n```json\nfilter={\n    \"ID\": {\n        \"$gte\" : 4\n    },\n    \"Name\": \"Example\"\n}\n```\n\n#### Supported Filters\n|Name|Key|Value|\n|--|--|--|\n|Greater Than|$gt|Integer|\n|Greater Than or Equal To|$gte|Integer|\n|In|$in|Array|\n|Not In|$nin|Array|\n|Like|$like|String|\n|Not Like|$nlike|String|\n|Less Than|$lt|Integer|\n|Less Than or Equal To|$lte|Integer|\n|Not|$not|String|\n\n### Order By\n```json\norderby={\n    \"Name\": \"ASC\",\n    \"ID\": \"DESC\"\n}\n```\n\n### Limit\n```limit=20```\n\n### Offset\n```offset=20```\n\n## Example\nThis example uses Slim Framework and converts a GET request into a database select query.\n\n```php\n\u003c?php\n\n// Provides composer dependencies.\nrequire_once 'vendor/autoload.php';\n\n// Start our Slim app.\n$App = new Slim\\App([\n    'settings'  =\u003e [\n        'displayErrorDetails' =\u003e true\n    ]\n]);\n\n// Add a database connection to our application container.\n$Container = $App-\u003egetContainer();\n\n$Container['DB'] = function ( $Container )\n{\n    // Setup our query adapter.\n    $Adapter = new Zend\\Db\\Adapter\\Adapter([\n        'database'  =\u003e 'Example',\n        'driver'    =\u003e 'Mysqli',\n        'host'      =\u003e 'localhost',\n        'password'  =\u003e '',\n        'username'  =\u003e 'ExampleUser'\n    ]);\n\n    // Now setup our sql object.\n    return new Zend\\Db\\Sql\\Sql( $Adapter );\n};\n\n// Setup our API route.\n$App-\u003eget('/', function ( $Request, $Response ) use ( $Container )\n{\n    // Parse any filters, etc.\n    $Parser = new AidanCasey\\HttpParser\\HttpToZend();\n    $Select = $Parser-\u003eConvertHttpRequest( $Request );\n    \n    // Prepare a query for the database.\n    $Statement  = $Container['DB']-\u003eprepareStatementForSqlObject(\n        $Select-\u003efrom('ExampleTable')\n    );\n\n    // Now execute that query.\n    $Result     = $Statement-\u003eexecute();\n});\n\n// Run our Slim app.\n$App-\u003erun();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faidan-casey%2Fhttp-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faidan-casey%2Fhttp-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faidan-casey%2Fhttp-parser/lists"}