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

ActiveLibrary

xaamin/validation
=================

Illuminate validation outside Laravel

v1.0.3(9y ago)14782PHPPHP &gt;=5.4

Since Dec 29Pushed 9y ago1 watchersCompare

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

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

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

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

### Installation

[](#installation)

`composer require xaamin/$validator`

### Usage

[](#usage)

```
use Xaamin\Validator\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

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

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

4

Last Release

3418d ago

### Community

Maintainers

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

---

Top Contributors

[![benxaamin](https://avatars.githubusercontent.com/u/21373088?v=4)](https://github.com/benxaamin "benxaamin (8 commits)")

### Embed Badge

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

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

###  Alternatives

[livewire/livewire

A front-end framework for Laravel.

23.5k75.5M1.8k](/packages/livewire-livewire)[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M597](/packages/laravel-ui)[propaganistas/laravel-phone

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

3.0k35.7M106](/packages/propaganistas-laravel-phone)[laravel/breeze

Minimal Laravel authentication scaffolding with Blade and Tailwind.

3.0k31.3M145](/packages/laravel-breeze)[spatie/laravel-honeypot

Preventing spam submitted through forms

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

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)

PHPackages © 2026

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