PHPackages                             elkadrey/form-request - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. elkadrey/form-request

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

elkadrey/form-request
=====================

Form request is a package for Lumen that lets developer validate form requests like Laravel does.

v5.1(1y ago)017MITPHPPHP ^7.2|^8.0

Since Mar 3Pushed 1y agoCompare

[ Source](https://github.com/elkadrey/form-request)[ Packagist](https://packagist.org/packages/elkadrey/form-request)[ RSS](/packages/elkadrey-form-request/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

Form-Request [![codecov](https://camo.githubusercontent.com/5a5c0beb1a22bec7ece6866dd142bc47d2cd6bd1050807f784da9b7a0d71206a/68747470733a2f2f636f6465636f762e696f2f67682f7373692d616e696b2f666f726d2d726571756573742f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d31503537373353305359)](https://codecov.io/gh/ssi-anik/form-request)[![Total Downloads](https://camo.githubusercontent.com/25df9883ebe18c4f9f13d2181e3fd7bee0384f0c3d51d532d24f2ff044a53788/68747470733a2f2f706f7365722e707567782e6f72672f616e696b2f666f726d2d726571756573742f646f776e6c6f616473)](//packagist.org/packages/anik/form-request)[![Latest Stable Version](https://camo.githubusercontent.com/55a71df7e459e7802f5c90f80258156d99a901e873826ae229f514835823573e/68747470733a2f2f706f7365722e707567782e6f72672f616e696b2f666f726d2d726571756573742f76)](//packagist.org/packages/anik/form-request)
==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#form-request)

A package that helps developer to segregate the validation logic from controller to a separate dedicated class. Lumen doesn't have any `FormRequest` class like Laravel. This will let you do that.

### Installation

[](#installation)

1. Install the package by running `composer require anik/form-request` from your terminal being in the project directory.
2. Register `\Anik\Form\FormRequestServiceProvider::class` to your `bootstrap/app.php` as a provider.

```
// bootstrap/app.php
$app->register(\Anik\Form\FormRequestServiceProvider::class);
```

### How to use?

[](#how-to-use)

- Create a class that extends `Anik\Form\FormRequest` class.
- You must override `rules` method of the `Anik\Form\FormRequest` class. Define your validation rules in it. Must return an **array**.
- You can define validation **messages** by overriding `messages` method. Default is `[]`.
- You can define custom pretty **attribute** names by overriding `attributes` method. Default is `[]`.
- You can override `authorize` method to define the authorization logic if the client is authorized to submit the form. Must return a boolean value. Default is `true`. When returning `false`, it'll raise `\Illuminate\Auth\Access\AuthorizationException` exception.
- If the validation fails, it will throw `Illuminate\Validation\ValidationException`.
    - By default, it returns response in `{"message": "The given data was invalid.", "errors": []}` format with status code `422`. Handle the exception in `app/Exceptions/Handler.php`'s `render` method if you want to modify the response.
    - Override the `statusCode` method to return the status of your choice. Must return `int`. Default is `422`.
    - Override the `errorMessage` method to return the message of your choice. Must return `string`. Default is `The given data was invalid.`
    - Override the `errorResponse` method to return response of your choice when the validation fails. Must return either of type `\Symfony\Component\HttpFoundation\Response` or `null`.
- Now you can inject your **Request** class through the method injections. All the methods of `Laravel\Lumen\Http\Request` class is available in your request class.
- The `FormRequest::validated()` method will return the validated data when the validation passes.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance44

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

439d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60830f0fe22af89caefe0e8281a537ff84766dd939e7a8e7b436f12e85c2ffa3?d=identicon)[elkadrey](/maintainers/elkadrey)

---

Top Contributors

[![ssi-anik](https://avatars.githubusercontent.com/u/2676602?v=4)](https://github.com/ssi-anik "ssi-anik (29 commits)")[![elkadrey](https://avatars.githubusercontent.com/u/2741848?v=4)](https://github.com/elkadrey "elkadrey (2 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

validationlumenform-request

### Embed Badge

![Health badge](/badges/elkadrey-form-request/health.svg)

```
[![Health](https://phpackages.com/badges/elkadrey-form-request/health.svg)](https://phpackages.com/packages/elkadrey-form-request)
```

###  Alternatives

[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M107](/packages/propaganistas-laravel-phone)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[anik/form-request

Form request is a package for Lumen that lets developer validate form requests like Laravel does.

50373.4k3](/packages/anik-form-request)[pearl/lumen-request-validate

Lumen doesn't have form request validator seperatly. This package helps developers to segregate the validation layer from the controller to a separate dedicated class

45390.3k2](/packages/pearl-lumen-request-validate)[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

759569.4k13](/packages/wendelladriel-laravel-validated-dto)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
