PHPackages                             alikhosravidev/laravel-verbose-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. [Testing &amp; Quality](/categories/testing)
4. /
5. alikhosravidev/laravel-verbose-validator

ActiveLaravel-package[Testing &amp; Quality](/categories/testing)

alikhosravidev/laravel-verbose-validator
========================================

Adds a verbose/trace mode to the Laravel Validator for easier debugging of complex validation rules.

v4.1.0(7mo ago)42MITPHPPHP ^8.3CI passing

Since Sep 18Pushed 7mo agoCompare

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

READMEChangelogDependencies (5)Versions (16)Used By (0)

Laravel Verbose Validator
=========================

[](#laravel-verbose-validator)

[](https://packagist.org/packages/alikhosravidev/laravel-verbose-validator)[](https://github.com/alikhosravidev/laravel-verbose-validator/actions)[](https://github.com/alikhosravidev/laravel-verbose-validator/blob/main/LICENSE.md)

This package adds a "verbose" or "trace" mode to Laravel's `Validator` class to simplify debugging complex validation rules. Stop guessing why a rule failed; with this package, you can get a complete, step-by-step report of every rule executed and its outcome.

---

🎯 Compatibility
---------------

[](#-compatibility)

This package is compatible with Laravel versions **8, 9, 10, 11, and 12**.

---

🚀 Installation
--------------

[](#-installation)

Install via Composer. Since this package is primarily for development, it's recommended to install it as a dev dependency (`--dev`):

```
composer require alikhosravidev/laravel-verbose-validator --dev
```

The package supports Laravel's auto-discovery, so you don't need to manually register the ServiceProvider.

---

⚙️ Configuration (Optional)
---------------------------

[](#️-configuration-optional)

You can publish the configuration file with the following command:

```
php artisan vendor:publish --provider="Alikhosravidev\VerboseValidator\VerboseValidatorServiceProvider"
```

This will create a `verbose-validator.php` file in your `config` directory.

**Automatic Verbose Mode:**

Verbose mode is controlled by the following setting:

```
'enabled' => env('VERBOSE_VALIDATOR_ENABLED', env('APP_DEBUG', false)),

// Determines which type of report should be attached on failed validation ('failed', 'passed', or 'all')
'failure_report_type' => env('VERBOSE_VALIDATOR_FAILURE_REPORT', 'failed'),
```

- If `APP_DEBUG=true`, verbose mode is enabled by default.
- If `APP_DEBUG=false`, verbose mode is disabled.
- You can override this behavior with `VERBOSE_VALIDATOR_ENABLED`.
- On failed validation, by default only the **failed rules** will be attached to the response.
- You can change this to `'all'` or `'passed'` in the config.

---

📖 Usage
-------

[](#-usage)

### Basic Usage

[](#basic-usage)

Simply chain the `->verbose()` method onto your `Validator::make()` call (unless automatic mode is enabled):

```
use Illuminate\Support\Facades\Validator;

$data = [
    'email' => 'test@example.com',
    'password' => '123',
];
$rules = [
    'email' => 'required|email',
    'password' => 'required|min:8',
];

$validator = Validator::make($data, $rules)->verbose();

if ($validator->fails()) {
    $report = $validator->getReport(); // full report
    dd($report);
}
```

---

### Filtering Reports

[](#filtering-reports)

The `getReport()` method accepts a filter argument:

```
$validator->getReport('all');    // default, all rules
$validator->getReport('failed'); // only failed rules
$validator->getReport('passed'); // only passed rules
```

For convenience, you can also call:

- `getFailedReport()` → Equivalent to `getReport('failed')`
- `getPassedReport()` → Equivalent to `getReport('passed')`

---

### Reports in Validation Failures

[](#reports-in-validation-failures)

When validation fails, Laravel throws a `ValidationException`. This package automatically attaches the validation report to the **422 JSON response** (only when verbose mode is active).

By default, only the **failed rules** are attached. You can change this via the `failure_report_type` config option.

**Example failed response (default):**

```
{
  "message": "The given data was invalid.",
  "errors": {
    "password": [
      "The password must be at least 8 characters."
    ]
  },
  "verbose_report": {
    "password": [
      {
        "rule": "Min",
        "parameters": ["8"],
        "value": "123",
        "result": false
      }
    ]
  }
}
```

---

### Reports in Successful Validation

[](#reports-in-successful-validation)

When validation passes, you can still access the report inside your application logic:

```
$report = $request->validator->getReport();
```

This will return the report based on the executed validation rules for that request.

---

🧩 Support for Custom Rules
--------------------------

[](#-support-for-custom-rules)

This package fully supports custom validation rules, both **Closure-based** and **Rule Objects**. The result of their execution will be logged in the report just like native Laravel rules.

---

🧪 Testing
---------

[](#-testing)

Run tests locally:

```
composer test
```

---

🙌 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please feel free to submit a pull request or open an issue.

---

📄 License
---------

[](#-license)

The MIT License (MIT). Please see the [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance62

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

15

Last Release

234d ago

Major Versions

v1.0.0 → v2.0.02025-09-18

v2.0.0 → v3.0.02025-09-18

v3.0.0 → v4.0.12025-09-18

v1.0.1 → v4.1.02025-09-20

2.x-dev → v3.1.02025-09-20

PHP version history (4 changes)v4.0.0PHP ^8.3

v1.0.0PHP ^8.0

v2.0.0PHP ^8.1

v3.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/272cbfd26fcb2e7e54586ea55a6aa98a880925d3563ec6f6a3ba93a8de98a196?d=identicon)[alikhosravidev](/maintainers/alikhosravidev)

---

Top Contributors

[![alikhosravidev](https://avatars.githubusercontent.com/u/49164621?v=4)](https://github.com/alikhosravidev "alikhosravidev (6 commits)")

---

Tags

testinglaravelvalidatorvalidationdebugpackageerrorsreporttrace

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/alikhosravidev-laravel-verbose-validator/health.svg)

```
[![Health](https://phpackages.com/badges/alikhosravidev-laravel-verbose-validator/health.svg)](https://phpackages.com/packages/alikhosravidev-laravel-verbose-validator)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2412.2M5](/packages/laravel-validation-rules-credit-card)[nunomaduro/laravel-mojito

A lightweight package for testing Laravel views.

368435.5k11](/packages/nunomaduro-laravel-mojito)[osteel/openapi-httpfoundation-testing

Validate HttpFoundation requests and responses against OpenAPI (3+) definitions

1201.9M6](/packages/osteel-openapi-httpfoundation-testing)

PHPackages © 2026

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