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

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

webreinvent/validation
======================

Use Illuminate Validation outside Laravel.

v4.0(8y ago)035MITPHP

Since Aug 6Pushed 8y ago1 watchersCompare

[ Source](https://github.com/modernpk/validation)[ Packagist](https://packagist.org/packages/webreinvent/validation)[ RSS](/packages/webreinvent-validation/feed)WikiDiscussions master Synced 3d ago

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

Illuminate Validator Outside Laravel
------------------------------------

[](#illuminate-validator-outside-laravel)

### Installation

[](#installation)

`composer require webreinvent/validation`

### Usage

[](#usage)

```
use Webreinvent\Validation\Validator;

$validator = new Validator;

```

##### Database presence verifier

[](#database-presence-verifier)

Using the [Illuminate Database Capsule](https://github.com/laravel/framework/tree/master/src/Illuminate/Database) set the database connection instance:

```
$db = $capsule->getDatabaseManager();

$validator->setConnection($db);

```

##### Providing a custom translator

[](#providing-a-custom-translator)

To provide a custom translator pass an instance of `Illuminate\Container\Container` with the translator bound to `translator`.

The translator must implement `Symfony\Component\Translation\TranslatorInterface`.

```
$container = new Illuminate\Container\Container;

$container['translator'] = new CustomTranslator();

$validator = new Validator($container);

```

##### Creating validators

[](#creating-validators)

```
$validator = Validator::make(
    [
        'name' => 'John',
        'last_name' => 'Doe'
    ],
    [
        'name' => ['required', 'min:3'],
        'last_name' => ['required', 'min:3']
    ]
);

```

##### Working with error messages

[](#working-with-error-messages)

After calling the errors method on a Validator instance, you will receive an `Illuminate\Support\MessageBag` instance, which has a variety of convenient methods for working with error messages.

Retrieving The First Error Message For A Field

To retrieve the first error message for a given field, use the first method:

```
$messages = $validator->errors();

echo $messages->first('email');

```

###### Retrieving all error messages for a field

[](#retrieving-all-error-messages-for-a-field)

If you wish to simply retrieve an array of all of the messages for a given field, use the get method:

```
foreach ($messages->get('email') as $message) {
    //
}

```

###### Retrieving all error messages for all fields

[](#retrieving-all-error-messages-for-all-fields)

To retrieve an array of all messages for all fields, use the all method:

```
foreach ($messages->all() as $message) {
    //
}

```

###### Determining if messages exist for a field

[](#determining-if-messages-exist-for-a-field)

```
if ($messages->has('email')) {
    //
}

```

###### Retrieving an error message with a format

[](#retrieving-an-error-message-with-a-format)

```
echo $messages->first('email', ':message');
Retrieving All Error Messages With A Format

foreach ($messages->all(':message') as $message) {
    //
}

```

See all avalilable rules and methods at [Laravel validations](https://laravel.com/docs/5.0/validation).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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

3203d ago

Major Versions

3.0 → v4.02017-08-06

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/45572020?v=4)[WebReinvent Technologies Pvt Ltd](/maintainers/webreinvent)[@webreinvent](https://github.com/webreinvent)

---

Top Contributors

[![themodernpk](https://avatars.githubusercontent.com/u/3604392?v=4)](https://github.com/themodernpk "themodernpk (10 commits)")

### Embed Badge

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

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

###  Alternatives

[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M107](/packages/propaganistas-laravel-phone)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[intervention/validation

Additional validation rules for the Laravel framework

6826.7M8](/packages/intervention-validation)[proengsoft/laravel-jsvalidation

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

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

759569.4k13](/packages/wendelladriel-laravel-validated-dto)

PHPackages © 2026

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