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

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

jaygaha/lumen-form-request
==========================

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

v1.0.2(6mo ago)058MITPHPPHP ^8.2

Since Oct 17Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/jaygaha/lumen-form-request)[ Packagist](https://packagist.org/packages/jaygaha/lumen-form-request)[ Docs](https://github.com/jaygaha/lumen-form-request)[ RSS](/packages/jaygaha-lumen-form-request/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (9)Versions (3)Used By (0)

Lumen Form Request
==================

[](#lumen-form-request)

Bring Laravel-style Form Request validation to Lumen! This package provides full Form Request functionality including validation, authorization, and the `make:request-form` artisan command for Lumen 11.

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

> Purposes to create a form request class that existing Lumen `form-request` packages do not support.

Laravel vs Lumen
----------------

[](#laravel-vs-lumen)

This package brings Laravel's FormRequest functionality to Lumen applications. While Lumen is designed to be a micro-framework, it often lacks some of the convenience features that Laravel provides. This package fills that gap by providing a complete FormRequest implementation that works seamlessly with Lumen 11.

### Why Use This Package?

[](#why-use-this-package)

- **Consistency**: Use the same validation patterns as Laravel applications
- **Productivity**: Reduce boilerplate validation code
- **Maintainability**: Centralize validation logic in dedicated classes
- **Reusability**: Share validation rules across different endpoints
- **Testing**: Easy to test validation logic in isolation

Features
--------

[](#features)

- Full Laravel Form Request functionality
- Lumen 11 support
- `make:request-form` artisan command
- Validation rules and messages
- Authorization checks
- Input data normalization
- Fully tested

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require jaygaha/lumen-form-request
```

### 1. Register Service Provider

[](#1-register-service-provider)

Add the service provider to the `bootstrap/app.php` file:

```
$app->register(JayGaha\LumenFormRequest\Providers\FormRequestServiceProvider::class);
```

That's it! You're ready to use Form Requests in your Lumen application.

### 2. Enable Validation (if not already enabled)

[](#2-enable-validation-if-not-already-enabled)

Make sure validation is enabled in your Lumen application. Add this to your `bootstrap/app.php`:

```
$app->withFacades();
$app->withEloquent();
```

Quick Start
-----------

[](#quick-start)

1. Generate a Form Request

You can generate a new Form Request class using the `make:request-form` artisan command:

```
php artisan make:request-form CreateUserFormRequest
```

This will create a new Form Request class in the `app/Http/Requests` directory.

```
