PHPackages                             xgbnl/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. xgbnl/validation

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

xgbnl/validation
================

Scene-based Validator in Laravel.

013PHP

Since Mar 19Pushed 2mo agoCompare

[ Source](https://github.com/xgbnl/laravel-validation)[ Packagist](https://packagist.org/packages/xgbnl/validation)[ RSS](/packages/xgbnl-validation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Scene Validator
===============

[](#scene-validator)

> Validator for Laravel framework with customized scenarios.

##### Simple install

[](#simple-install)

```
$ composer require xgbnl/validation dev-main
```

##### Create scene validator

[](#create-scene-validator)

```
$ php artisan make:validator UserValidator
```

##### Define validation scenarios

[](#define-validation-scenarios)

```
//  Add a validation scene to the authenticator.
public function scenes():array
{
    return [
        'store' => 'name,phone,age,email',
        'update' =>['name','age'],
    ];
}

// The custom scene is invoked in Controller.
public function store(UserValidator $userValidator):mixed
{
    $userValidator->withScene('store')->validatedForm(); // returns DataTransfer

    $userValidator->withScene('update')->validatedRaw(); // returns array

    // do something...
}
```

##### Extend the custom validation rule method

[](#extend-the-custom-validation-rule-method)

```
// Add a password validation rule to the authenticator.
public function passwordRules():array
{
    return [
        'password'=> 'required|string|min:6',
        'password_confirm' =>'required|same:password'
    ];
}

// The custom rule is invoked in Controller.
public function update(UserValidator $userValidator):mixed
{
    $userValidator->withScene('update')
        ->withRule('password')
        ->validateForm();

    // do something...
}
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance58

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/41fb2518f7461b7f32520ef21e322bd837a936ccab733efd2e01879e70f1ade8?d=identicon)[xgbnl](/maintainers/xgbnl)

---

Top Contributors

[![xgbnl](https://avatars.githubusercontent.com/u/52394568?v=4)](https://github.com/xgbnl "xgbnl (70 commits)")

### Embed Badge

![Health badge](/badges/xgbnl-validation/health.svg)

```
[![Health](https://phpackages.com/badges/xgbnl-validation/health.svg)](https://phpackages.com/packages/xgbnl-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.9M104](/packages/bensampo-laravel-enum)[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)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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