PHPackages                             agoalofalife/decompose-validator - 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. agoalofalife/decompose-validator

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

agoalofalife/decompose-validator
================================

Extra package for organization and decompose request validation in Laravel

v1.0.0(5y ago)3361MITPHPPHP &gt;=7.3.0

Since Apr 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/agoalofalife/decompose-validator)[ Packagist](https://packagist.org/packages/agoalofalife/decompose-validator)[ RSS](/packages/agoalofalife-decompose-validator/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Decompose laravel validation
============================

[](#decompose-laravel-validation)

Package helps you decompose validation in you project Laravel

- [What is it?](#what)
- [Installation](#installation)
- [Create Validator Value](#create)
- [How Do I can use in Form Request](#useInFormRequest)
- [How Do I use in simple way validation](#useJustWay)
- [Article](#article)

What is it?
-----------

[](#what-is-it)

Package give you a chance split validation fields. Each filed and dataset rules is independent class. It gives freedom in action and centralization validation in one place. For more understanding reading my article in [medium](https://agoalofalife.medium.com/decompose-form-request-in-laravel-5997997f1f1) .

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

[](#installation)

```
composer require agoalofalife/decompose-validator
```

Laravel versionPackage Version7181

Create Validator Value
----------------------

[](#create-validator-value)

Let's have a look email validation example. Should implementation ValidatorValue. Describe rules and extra messages. I prefer `$attribute` set in contstruct with value by default, but you can return just string in method.

```
use agoalofalife\DecomposeValidator\ValidatorValue;

class ConsumerEmail implements ValidatorValue
{
    /**
     * @var string
     */
    private $attribute;

    /**
     * @var int
     */
    private $exceptConsumerId;

    public function __construct(
        int $consumerId,
        string $attribute = 'email'
    ) {
        $this->exceptConsumerId = $consumerId;
        $this->attribute = $attribute;
    }

    public function getAttribute(): string
    {
        return $this->attribute;
    }

    public function getRules(): array
    {
        return [
            'required',
            'email',
            'unique:users,email,'.$this->exceptConsumerId,
        ];
    }

    public function getMessages(): array
    {
        return [
            "{$this->attribute}.email"         => 'Please field should be email',
            "{$this->attribute}.required"      => 'Please email is required field',
            "{$this->attribute}.unique"        => 'Email has registered already',
            "{$this->attribute}.email_checker" => 'Email does not exist',
        ];
    }
}
```

Use in Form Request
-------------------

[](#use-in-form-request)

Pay attention parent name class. You should extend of it.

```
use agoalofalife\DecomposeValidator\FormRequestDecompose;

class UpdateUserProfile extends FormRequestDecompose
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            new ConsumerEmail(),
            'name'       => ['required', 'alpha'],
            'age'        => ['integer', 'max:120'],
        ];
    }
}
```

Use in Simple Validation(controller or facade)
----------------------------------------------

[](#use-in-simple-validationcontroller-or-facade)

Also we have a chance use simple validation.

```
/**
 * Store a new blog post.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(Request $request)
{
    $validatorValue = new ConsumerEmail(request->auth()->id);
    $validated = $request->validate([
         $validatorObject->getAttribute() => $validatorObject->getRules()
    ]);

   //...
}
```

Article
-------

[](#article)

Also I wrote the aritcle in [medium](https://agoalofalife.medium.com/decompose-form-request-in-laravel-5997997f1f1)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1836d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/de0b1f6d64571d925fd7580acf7f99394511ad98c4befd6d2d9e1ef64ea1ea8e?d=identicon)[agoalofalife](/maintainers/agoalofalife)

---

Top Contributors

[![agoalofalife](https://avatars.githubusercontent.com/u/15719824?v=4)](https://github.com/agoalofalife "agoalofalife (11 commits)")

---

Tags

laravelvalidationdecompose

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/agoalofalife-decompose-validator/health.svg)

```
[![Health](https://phpackages.com/badges/agoalofalife-decompose-validator/health.svg)](https://phpackages.com/packages/agoalofalife-decompose-validator)
```

###  Alternatives

[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)[carsdotcom/laravel-json-schema

Json Schema validation for Laravel projects

1036.7k3](/packages/carsdotcom-laravel-json-schema)

PHPackages © 2026

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