jaygaha/lumen-form-request
Composer 安装命令:
composer require jaygaha/lumen-form-request
包简介
Form request is a package for Lumen that lets developer validate form requests like Laravel does.
README 文档
README
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-requestpackages do not support.
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?
- 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
- Full Laravel Form Request functionality
- Lumen 11 support
make:request-formartisan command- Validation rules and messages
- Authorization checks
- Input data normalization
- Fully tested
Installation
You can install the package via composer:
composer require jaygaha/lumen-form-request
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)
Make sure validation is enabled in your Lumen application. Add this to your bootstrap/app.php:
$app->withFacades(); $app->withEloquent();
Quick Start
- 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.
<?php declare(strict_types=1); namespace App\Http\Requests; use JayGaha\LumenFormRequest\Requests\FormRequest; class CreateUserFormRequest extends FormRequest { /** * Determine if the user is authorized to make this request. */ public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. */ public function rules(): array { return [ // ]; } }
Support
If you find this package useful, please consider:
- Starring the repository
- Reporting bugs
- Suggesting new features
- Contributing to the project
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
The MIT License (MIT). Please see License File for more information.
jaygaha/lumen-form-request 适用场景与选型建议
jaygaha/lumen-form-request 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 58 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「validation」 「lumen」 「form-request」 「php8」 「lumen 11」 「lumen 12」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jaygaha/lumen-form-request 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jaygaha/lumen-form-request 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jaygaha/lumen-form-request 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Testing Suite For Lumen like Laravel does.
Form request is a package for Lumen that lets developer validate form requests like Laravel does.
Laravel Form Request adaptation for Lumen framework.
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
Class to generate a standard structure for api json responses
Adds request-parameter validation to the SLIM 3.x PHP framework
统计信息
- 总下载量: 58
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-17