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

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

yemenifree/laravel-validation
=============================

Use laravel validation standalone support translate.

0.0.8(8y ago)2551PHP

Since Nov 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/salkhwlani/laravel-validation)[ Packagist](https://packagist.org/packages/yemenifree/laravel-validation)[ RSS](/packages/yemenifree-laravel-validation/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (9)Used By (1)

PHP Laravel Validation.
=======================

[](#php-laravel-validation)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/48fb885a5ce40885408d1341775d77825c2f857232ceaf54317ae76e9b005bcc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f79656d656e69667265652f6c61726176656c2d76616c69646174696f6e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yemenifree/laravel-validation/build-status/maste)[![Quality Score](https://camo.githubusercontent.com/678209ad8a0fb6855e531c14cf69a87f35fcf12fa9f6e72ed46cae3617a75e86/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f79656d656e69667265652f6c61726176656c2d76616c69646174696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yemenifree/laravel-validation/code-structure)

> A tiny package to use laravel validation outside laravel with support translate error message. this package is extend for [rakit/validation](https://github.com/rakit/validation) so read it's document for more information.

Features
--------

[](#features)

- Init validation easy with trait.
- Support Multi lang for error messages.
- More come soon.

Requirements &amp; Installation
-------------------------------

[](#requirements--installation)

> Requires PHP 7.0+

Via Composer

```
$ composer require yemenifree/laravel-validation
```

Getting Started
---------------

[](#getting-started)

To init validation on class add `HasValidator` trait.

```
use Yemenifree\Validation\Traits\HasValidator;

class SomeController
{
    use HasValidator;
    //
}
```

Then to valid some data you can pass array for data &amp; rules and others options.

```
    $this->valid(array $data, array $rules, array $messages = [], array $aliases = [])
```

For example

```
/**
 * Register User
 *
 * @return array
 */
public function register()
{
    $isValid = $this->valid(
    [
        'username' => 'salah',
            'password' => 'test'
    ]
    , [
        'username' => 'required',
        'password' => 'required',
    ]);

    if(!$isValid){
        // data not valid.
    }

    // every thing right.
}
```

If you have same response for all form in controller you can handler validation error once by create `InValidCallback` in class.

```
use Yemenifree\Validation\Traits\HasValidator;

class SomeController
{
    use HasValidator;

    /**
     * Register User
     *
     * @return array
     */
    public function register()
    {
        $isValid = $this->valid(
        [
            'username' => 'salah',
            'password' => 'test'
        ]
        , [
            'username' => 'required',
            'password' => 'required',
        ]);

        // if data not valid will excute `InValidCallback` in this class.
        if(!$isValid)
        {
            return;
        }

        // every thing right.
    }

    /**
     * In valid function.
     *
     * @param array $errors
     *
     * @throws InvalidArgumentException
     */
    public function InValidCallback(array $errors)
    {
        // do whatevet you want with errors.

        return false;
    }
}
```

You can use custom translate file for validation errors.

```
use Yemenifree\Validation\Traits\HasValidator;

class SomeController
{
    use HasValidator;

    public function __construct()
    {
        $this->setValidatorLocal(
// file name wihout .php
        'ar',
        // path of translate
        'translate/path'
        );
    }

    /**
     * Register User
     *
     * @return array
     */
    public function register()
    {
        $isValid = $this->valid(
        [
            'username' => 'salah',
            'password' => 'test'
        ]
        , [
            'username' => 'required',
            'password' => 'required',
        ]);

         if(!$isValid)
        {
            // message errors.
            $errors = $this->getValidErrors();
        }

        // every thing right.
    }
}
```

> translate files must return array of messages. see `src/lang/ar.php` for example.

To access to all method of `Validator` use `getValidator()` method.

```
use Yemenifree\Validation\Traits\HasValidator;

class SomeController
{
    use HasValidator;

    public function __construct()
    {
        // add custom rule.
        $this->getValidator()->addValidator('simple', new SimpleRule());
    }
}
```

> For more information about rules check [rakit/validation](https://github.com/rakit/validation)

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Rakit/validation](https://github.com/rakit/validation)
- [Salah Alkhwlani](https://github.com/yemenifree)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

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

8

Last Release

3088d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60036767b6c53b6c4266f7b46348b93b505cf278203df5d7c06d5f7661d1fcc3?d=identicon)[salahalkhwlani](/maintainers/salahalkhwlani)

---

Top Contributors

[![salkhwlani](https://avatars.githubusercontent.com/u/10876587?v=4)](https://github.com/salkhwlani "salkhwlani (16 commits)")

---

Tags

laravelphpstandalonevalidationwordpress

### Embed Badge

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

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

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