PHPackages                             aminevsky/laravel-validation-rule-formatter - 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. aminevsky/laravel-validation-rule-formatter

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

aminevsky/laravel-validation-rule-formatter
===========================================

A Formatter of Laravel Validation Rule

v1.0.1(5y ago)02MPL-2.0PHPPHP ^7.3

Since Sep 23Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Aminevsky/laravel-validation-rule-formatter)[ Packagist](https://packagist.org/packages/aminevsky/laravel-validation-rule-formatter)[ RSS](/packages/aminevsky-laravel-validation-rule-formatter/feed)WikiDiscussions master Synced 1mo ago

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

A Formatter of Laravel Validation Rule

Requirements
------------

[](#requirements)

- PHP ^7.3
- Laravel ^7.0 | ^8.0

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

[](#installation)

```
composer require aminevsky/laravel-validation-rule-formatter

```

Features
--------

[](#features)

This formats validation rules that are passed to Laravel's validator.

Classes and Methods
-------------------

[](#classes-and-methods)

### `ValidationRuleFormatter`

[](#validationruleformatter)

#### `addRule()`

[](#addrule)

Add a rule for specified attribute.

- Parameters
    - Attribute
        - **(Required)** String
        - Attribute Name that the rule applies to
    - Rule Name
        - **(Required)** String
        - Rule name (ex. `required`, `max`)
    - Rule Parameters
        - (Optional) Mixed, Variable arguments
        - Parameters for the rule
- Return value
    - Self (`ValidationRuleFormatter` instance)

#### `format()`

[](#format)

Return formatted rules.

- Parameters
    - None
- Return value
    - Array
    - This can be passed to Laravel's validator

Example
-------

[](#example)

### Before

[](#before)

Without this library, you would write like this:

```
class TodoController extends Controller
{
    const TITLE_MAX_LENGTH = 1000;

    public function store(Request $request)
    {
        $request->validate([
            'title'     => ['required', 'max:' . self::TITLE_MAX_LENGTH],
        ]);

        // ...
    }
}
```

### After

[](#after)

With this library, you can write like this:

```
class TodoController extends Controller
{
    const TITLE_MAX_LENGTH = 1000;

    public function store(Request $request)
    {
        // Add validation rules.
        $rules = ValidationRuleFormatter::addRule('title', 'required')
            ->addRule('title', 'max', self::TITLE_MAX_LENGTH)
           // Format rules.
            ->format();

        // Pass formatted rules to default validator.
        $request->validate($rules);

        // ...
    }
}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Every ~0 days

Total

2

Last Release

2057d ago

### Community

Maintainers

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

---

Top Contributors

[![Aminevsky](https://avatars.githubusercontent.com/u/2969194?v=4)](https://github.com/Aminevsky "Aminevsky (5 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/aminevsky-laravel-validation-rule-formatter/health.svg)

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

###  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)
