albertcht / lumen-form-request
Form request is a package for Lumen that lets developer validate form requests like Laravel does.
v2.3
2017-12-31 16:55 UTC
Requires
- php: >=5.6
- illuminate/support: ~5
Requires (Dev)
- phpunit/phpunit: ^4.8 || ^5.0
This package is auto-updated.
Last update: 2024-11-29 05:38:58 UTC
README
Description
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
composer require albertcht/lumen-form-request
- Add the service provider in
bootstrap/app.php
$app->register(AlbertCht\Form\FormRequestServiceProvider::class);
Next step is create your FormRequest and extends from AlbertCht\Form\FormRequest
Example
<?php namespace App\Http\Requests; use AlbertCht\Form\FormRequest; class StoreDeviceRequest extends FormRequest { public function authorize() { return true; } public function rules() { return [ 'mac_address' => 'required|unique:devices,mac_address' ]; } }