{"id":19518777,"url":"https://github.com/ssi-anik/form-request","last_synced_at":"2025-07-18T19:04:07.189Z","repository":{"id":24411974,"uuid":"101423254","full_name":"ssi-anik/form-request","owner":"ssi-anik","description":"Form request is a package for Lumen that lets developer validate form requests like Laravel does.","archived":false,"fork":false,"pushed_at":"2024-03-02T10:50:52.000Z","size":25,"stargazers_count":50,"open_issues_count":1,"forks_count":25,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-22T04:48:06.023Z","etag":null,"topics":["form-request-validation","form-validation","lumen","lumen-package","php","validation"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/anik/form-request","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/ssi-anik.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-25T16:41:38.000Z","updated_at":"2025-02-28T15:08:50.000Z","dependencies_parsed_at":"2024-06-18T13:34:33.816Z","dependency_job_id":"cf284f8d-9a55-4542-a029-cb6e2741c908","html_url":"https://github.com/ssi-anik/form-request","commit_stats":{"total_commits":28,"total_committers":4,"mean_commits":7.0,"dds":0.1071428571428571,"last_synced_commit":"9c3aa82adc07c6431c0968fdaf36a4abc6e68c51"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/ssi-anik/form-request","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi-anik%2Fform-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi-anik%2Fform-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi-anik%2Fform-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi-anik%2Fform-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssi-anik","download_url":"https://codeload.github.com/ssi-anik/form-request/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi-anik%2Fform-request/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265815247,"owners_count":23832873,"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":["form-request-validation","form-validation","lumen","lumen-package","php","validation"],"created_at":"2024-11-11T00:14:28.002Z","updated_at":"2025-07-18T19:04:07.161Z","avatar_url":"https://github.com/ssi-anik.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Form-Request\n[![codecov](https://codecov.io/gh/ssi-anik/form-request/branch/master/graph/badge.svg?token=1P5773S0SY)](https://codecov.io/gh/ssi-anik/form-request)\n[![Total Downloads](https://poser.pugx.org/anik/form-request/downloads)](//packagist.org/packages/anik/form-request)\n[![Latest Stable Version](https://poser.pugx.org/anik/form-request/v)](//packagist.org/packages/anik/form-request)\n===\n\nA package that helps developer to segregate the validation logic from controller to a separate dedicated class. Lumen\ndoesn't have any `FormRequest` class like Laravel. This will let you do that.\n\n### Installation\n\n1. Install the package by running `composer require anik/form-request` from your terminal being in the project\n   directory.\n2. Register `\\Anik\\Form\\FormRequestServiceProvider::class` to your `bootstrap/app.php` as a provider.\n\n```php\n// bootstrap/app.php\n$app-\u003eregister(\\Anik\\Form\\FormRequestServiceProvider::class);\n```\n\n### How to use?\n\n- Create a class that extends `Anik\\Form\\FormRequest` class.\n- You must override `rules` method of the `Anik\\Form\\FormRequest` class. Define your validation rules in it. Must return\n  an **array**.\n- You can define validation **messages** by overriding `messages` method. Default is `[]`.\n- You can define custom pretty **attribute** names by overriding `attributes` method. Default is `[]`.\n- You can override `authorize` method to define the authorization logic if the client is authorized to submit the form.\n  Must return a boolean value. Default is `true`. When returning `false`, it'll\n  raise `\\Illuminate\\Auth\\Access\\AuthorizationException` exception.\n- If the validation fails, it will throw `Illuminate\\Validation\\ValidationException`.\n    - By default, it returns response in `{\"message\": \"The given data was invalid.\", \"errors\": []}` format with status\n      code `422`. Handle the exception in `app/Exceptions/Handler.php`'s `render` method if you want to modify the\n      response.\n    - Override the `statusCode` method to return the status of your choice. Must return `int`. Default is `422`.\n    - Override the `errorMessage` method to return the message of your choice. Must return `string`. Default\n      is `The given data was invalid.`\n    - Override the `errorResponse` method to return response of your choice when the validation fails. Must return\n      either of type `\\Symfony\\Component\\HttpFoundation\\Response` or `null`.\n- Now you can inject your **Request** class through the method injections. All the methods\n  of `Laravel\\Lumen\\Http\\Request` class is available in your request class.\n- The `FormRequest::validated()` method will return the validated data when the validation passes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssi-anik%2Fform-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssi-anik%2Fform-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssi-anik%2Fform-request/lists"}