PHPackages                             bekusc/laravel-auto-validation - 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. bekusc/laravel-auto-validation

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

bekusc/laravel-auto-validation
==============================

1.0.1(9y ago)611723PHP

Since May 3Pushed 9y ago1 watchersCompare

[ Source](https://github.com/bekusc/laravel-auto-validation)[ Packagist](https://packagist.org/packages/bekusc/laravel-auto-validation)[ RSS](/packages/bekusc-laravel-auto-validation/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Laravel Auto-validation
=======================

[](#laravel-auto-validation)

This package will allow you to remove all manual validations from your controllers.

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

[](#installation)

Simply go to your project directory where the `composer.json` file is located and type in your terminal:

```
composer require bekusc/laravel-auto-validation
```

Add the service provider to your `providers` array in `config/app.php`:

```
'providers' => [
    // ...
    Bekusc\Validation\AutoValidationProvider::class,
],
```

Add the trait to your base controller `App\Http\Controllers\Controller`:

```
use Bekusc\Validation\Traits\AutoValidation;

class Controller extends BaseController
{
    use AutoValidation;
}
```

Publish config:

```
php artisan vendor:publish --provider="Bekusc\Validation\AutoValidationProvider"

```

Update config file with your validation rules in:

```
config/validation.php

```

Example
-------

[](#example)

`config/validation.php` file:

```
use Illuminate\Validation\Rule;

$rules = [
    'UserController' => [
        'register' => [
            'name'     => 'required|max:255',
            'email'    => ['required', 'email', 'max:255', Rule::unique('users')->where('status', 1)],
            'password' => 'required|min:6|confirmed',
            'gender'   => 'required|in:male,female',
            'birthday' => 'required|date_format:Y-n-j',
        ],
        'update' => function ($request) {
            return [
                'name'     => 'required|max:255',
                'email'    => 'required|email|max:255|unique:users,email,'.$request->user()->id,
                'gender'   => 'required|in:male,female',
                'birthday' => 'required|date_format:Y-n-j',
            ];
        },
    ],
];

return ['rules' => $rules];
```

`UserController.php` file:

```
class UserController extends Controller
{
    public function register(Request $request)
    {
        // The incoming request is valid...
        User::create($request->all());
    }

    public function update(Request $request)
    {
        // The incoming request is valid...
        $request->user()->update($request->all());
    }
}
```

Note
----

[](#note)

If validation fails, a redirect response will be generated to send the user back to their previous location. The errors will also be flashed to the session so they are available for display. If the request was an AJAX request, a HTTP response with a 422 status code will be returned to the user including a JSON representation of the validation errors.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

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

###  Release Activity

Cadence

Every ~5 days

Total

2

Last Release

3289d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/95147bf599893c2bf91941c3a570dc11bc92a395a49800875d648a9c36e4fdfc?d=identicon)[bekusc](/maintainers/bekusc)

---

Top Contributors

[![reibengu](https://avatars.githubusercontent.com/u/4273878?v=4)](https://github.com/reibengu "reibengu (5 commits)")[![lex111](https://avatars.githubusercontent.com/u/4408379?v=4)](https://github.com/lex111 "lex111 (1 commits)")

### Embed Badge

![Health badge](/badges/bekusc-laravel-auto-validation/health.svg)

```
[![Health](https://phpackages.com/badges/bekusc-laravel-auto-validation/health.svg)](https://phpackages.com/packages/bekusc-laravel-auto-validation)
```

###  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.9M105](/packages/bensampo-laravel-enum)[nette/forms

📝 Nette Forms: generating, validating and processing secure forms in PHP. Handy API, fully customizable, server &amp; client side validation and mature design.

54013.2M450](/packages/nette-forms)[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)

PHPackages © 2026

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