xaamin/lumen-validation

13
Install
composer require xaamin/lumen-validation
Latest Version:v1.0
License:MIT
Last Updated:Apr 21, 2023
Links: GitHub  ·  Packagist
Maintainer: xaamin

Introduction

Lumen Validation provides request validation like Laravel does using Form Requests.

Installation

This package requires requires php >= 8.0 and lumen >= 9

Step 1 - Install the package on your project

composer require xaamin/lumen-validation

Step 2 - Add the service provider in bootstrap/app.php

$app->register(
    Lumen\Validation\ValidationServiceProvider::class
);

Step 3 - Extend your request from Lumen\Validation\BaseRequest and injecting it into your controllers automatically will perform the validations. Use the authorize method to determine if the user could access the current request.

use Lumen\Validation\BaseRequest;

class CreateUserRequest extends BaseRequest
{
    protected function authorize()
    {
        return true;
    }

    protected function rules(): array
    {
        return  [
            'email' => ['required', 'string', 'unique:users'],
            'name' => ['required', 'string', 'max: 200'],
        ];
    }
}

License

Lumen Validation is open-sourced software licensed under the MIT license.

Related Packages

erirk/paypalpayment

laravel-paypalpayment is simple package help you process direct credit card paym...

0
gabrieloliverio/laravel5-generators

Database metadata-based generators for Laravel 5

1
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

617,346,630 9,703
laravel/framework

The Laravel Framework.

558,184,770 34,846
laravel/tinker

Powerful REPL for the Laravel framework.

468,807,761 7,441