{"id":16423373,"url":"https://github.com/ngekoding/lumen-api-query-parser-php5","last_synced_at":"2025-07-04T11:02:23.303Z","repository":{"id":57026373,"uuid":"187955623","full_name":"ngekoding/lumen-api-query-parser-php5","owner":"ngekoding","description":"A query parser for REST-APIs based on laravel's lumen framework","archived":false,"fork":false,"pushed_at":"2019-05-22T04:23:14.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T13:47:05.352Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ngekoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-22T03:22:37.000Z","updated_at":"2021-03-19T23:43:10.000Z","dependencies_parsed_at":"2022-08-23T16:11:10.932Z","dependency_job_id":null,"html_url":"https://github.com/ngekoding/lumen-api-query-parser-php5","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngekoding%2Flumen-api-query-parser-php5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngekoding%2Flumen-api-query-parser-php5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngekoding%2Flumen-api-query-parser-php5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngekoding%2Flumen-api-query-parser-php5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ngekoding","download_url":"https://codeload.github.com/ngekoding/lumen-api-query-parser-php5/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240587517,"owners_count":19825003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-10-11T07:39:36.927Z","updated_at":"2025-02-25T01:40:24.018Z","avatar_url":"https://github.com/ngekoding.png","language":"PHP","readme":"# Lumen API query parser\n### !!! I have edit the original package to support php5 !!!\n\nThe original package go here:\n- https://github.com/ngabor84/lumen-api-query-parser\n- https://packagist.org/packages/ngabor84/lumen-api-query-parser\n\nIf you need php5 support, so you can use this package. But if you already using php7, please use the original package.\n\n## Description\nThis is a simple request query parameter parser for REST-APIs based on Laravel's Lumen framework.\n\n## Requirements\n- PHP \u003e=5.6\n- Lumen framework \u003e= 5.4\n- Mockery \u003e= 0.9 (dev)\n- PHPUnit \u003e= 6.1 (dev)\n- PHP CodeSniffer \u003e= 3.0.0 RC4 (dev)\n\n## Installation\n- Add ngekoding/lumen-api-query-parser-php5 to your composer.json and make composer update, or composer require ngekoding/lumen-api-query-parser-php5 ~1.0\n- Setup the service provider:\n    in bootstrap/app.php add the following line:\n    ```php\n    $app-\u003eregister(LumenApiQueryParser\\Provider\\RequestQueryParserProvider::class);\n    ```\n    \n## Usage\n```php\n    // app/API/V1/Models/UserController.php\n    namespace App\\Api\\V1\\Http\\Controllers;\n    \n    use App\\Api\\V1\\Models\\User;\n    use App\\Api\\V1\\Transformers\\UserTransformer;\n    use LumenApiQueryParser\\ResourceQueryParserTrait;\n    use LumenApiQueryParser\\BuilderParamsApplierTrait;\n    \n    class UserController extends Controller\n    {\n        use ResourceQueryParserTrait;\n        use BuilderParamsApplierTrait;\n                \n        public function index(Request $request)\n        {\n            $params = $this-\u003eparseQueryParams($request);\n            $query = User::query();\n            $userPaginator = $this-\u003eapplyParams($query, $params);\n            \n            $this-\u003eresponse-\u003epaginator($userPaginator, new UserTransformer, ['key' =\u003e 'users']);\n        }\n    }\n```\n\n## Query syntax\n\n### Eager loading\nQ: /users?includes[]=profile  \nR: will return the collection of the users with their profiles included\n\n### Filtering\nQ: /users?filter[]=name:ct:admin    \nR: will return the collection of the users whose names contains the admin string\n\n__Available filter options__    \n\n| Operator      | Description           | Example |\n| ------------- | --------------------- | ------- |\n| ct            | String contains       | name:ct:Peter |\n| nct           | String NOT contains   | name:nct:Peter |\n| sw            | String starts with    | username:sw:admin |\n| ew            | String ends with      | email:ew:gmail.com |\n| eq            | Equals                | level:eq:3 |\n| ne            | Not equals            | level:ne:4 |\n| gt            | Greater than          | level:gt:2 |\n| ge            | Greater than or equal | level:ge:3 |\n| lt            | Lesser than           | level:lt:4 |\n| le            | Lesser than or equal  | level:le:3 |\n| in            | In array              | level:in:1\u0026#124;2\u0026#124;3 |\n\n### Sorting\nQ: /users?sort[]=name:ASC   \nR: will return the collection of the users sort by their names ascending\n\n### Pagination\nQ: /users?limit=10\u0026page=3   \nR: will return a part of the collection of the users (from the 21st to 30th)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngekoding%2Flumen-api-query-parser-php5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fngekoding%2Flumen-api-query-parser-php5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngekoding%2Flumen-api-query-parser-php5/lists"}