PHPackages                             mangel1196/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. mangel1196/form-request

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

mangel1196/form-request
=======================

Form request is a package for Lumen that lets developer validate form requests like Laravel does. from ssi-anik repository

00PHP

Since Jul 19Pushed 2y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)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

12

—

LowBetter than 0% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/99e6db8022d6727b1281721b8f05971dd86a2c912f4f5c4e6469071994126b79?d=identicon)[mangel1196](/maintainers/mangel1196)

---

Top Contributors

[![mangel1196](https://avatars.githubusercontent.com/u/26174021?v=4)](https://github.com/mangel1196 "mangel1196 (4 commits)")

### Embed Badge

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

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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