PHPackages                             jedrzej/validator-extended-syntax - 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. jedrzej/validator-extended-syntax

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

jedrzej/validator-extended-syntax
=================================

Laravel 4/5 package that adds validator negation to Laravel's validation module

0.0.4(9y ago)311.5k[2 issues](https://github.com/jedrzej/validator-extended-syntax/issues)MITPHP

Since Aug 29Pushed 7y ago2 watchersCompare

[ Source](https://github.com/jedrzej/validator-extended-syntax)[ Packagist](https://packagist.org/packages/jedrzej/validator-extended-syntax)[ Docs](https://github.com/validator-extended-syntax)[ RSS](/packages/jedrzej-validator-extended-syntax/feed)WikiDiscussions master Synced today

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

Extended Validation for Laravel 5
=================================

[](#extended-validation-for-laravel-5)

This package extends Laravel's validation syntax with the following:

- aliasing validation rule configurations
- negating validation rules
- using automatically replaced placeholders

Composer install
----------------

[](#composer-install)

Add the following line to `composer.json` file in your project:

```
"jedrzej/validator-extended-syntax": "0.0.3"

```

or run the following in the commandline in your project's root folder:

```
composer require "jedrzej/validator-extended-syntax" "0.0.3"

```

Usage
-----

[](#usage)

In order to extend validator syntax, you need to register `ValidationServiceProvider` in your `config/app.php`:

```
    'providers' => [
        ...
        /*
         * Custom proviers
         */
        'Jedrzej\Validation\ValidationServiceProvider'
    ];
```

### Aliasing validation rules

[](#aliasing-validation-rules)

It is possible to alias often used rule configuration to allow for reuse. This is an alternative to writing custom validation rules.

```
    // validate if string is a hex calue
    Validator::alias('hex', 'regex:/^[0-9a-fA-F]+$/');
    $rules = [
      'value' => 'hex'
    ];
    $validator = Validator::make($data, $rules);

    // passing arguments to aliases
    // validate number is a positive integer no larger than 100
    Validator::alias('positive_limited', 'between:1,?');
    $rules = [
      'value' => 'positive_limited:100'
    ];
    $validator = Validator::make($data, $rules);

    // record exists with is_active flag set
    Validator::alias('active_exists', 'exists:?,?,is_active,1');
    $rules = [
      'user_id' => 'active_exists:users,id'
    ];
    $validator = Validator::make($data, $rules);
```

### Negating validation results

[](#negating-validation-results)

When defining validation rules, you can negate chosen rule by prepending its name with exclamation mark. Negated validation rules will fail when not negated rule would pass and vice versa.

```
    $rules = ['string' => 'min:3']; //validate if string is at least 3 characters long
    $data = ['string' => 'abcde'];
    $result = Validator::make($data, $rules)->passes(); // TRUE

    $rules = ['string' => 'min:3'];
    $data = ['string' => 'ab'];
    $result = Validator::make($data, $rules)->passes(); // FALSE

    $rules = ['string' => '!min:3'];
    $data = ['string' => 'abcde'];
    $result = Validator::make($data, $rules)->passes(); // FALSE

    $rules = ['string' => '!min:3'];
    $data = ['string' => 'ab'];
    $result = Validator::make($data, $rules)->passes(); // TRUE
```

### Placeholders in validation rules

[](#placeholders-in-validation-rules)

If validation of one field needs to use the value of another field as parameter, you can use a `{{parameter_name}}` placeholder in rule definition instead of parameter value. Value of corresponding field will be passed to validator instead of the placeholder. If the corresponding value is missing in validated data set, the value will be taken from Config. If it's missing in config, `NULL` will be used.

```
    $rules = [
        'user_id' => 'exists:users,id'
        'email'   => 'unique:users,email,{{user_id}}',
        'age'     => 'min:{{app.min_age}}
    ];
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

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 ~190 days

Total

4

Last Release

3391d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/291904?v=4)[Jędrzej Kuryło](/maintainers/jedrzej)[@jedrzej](https://github.com/jedrzej)

---

Top Contributors

[![jedrzej](https://avatars.githubusercontent.com/u/291904?v=4)](https://github.com/jedrzej "jedrzej (14 commits)")

---

Tags

laravelvalidationlaravelvalidation

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/jedrzej-validator-extended-syntax/health.svg)

```
[![Health](https://phpackages.com/badges/jedrzej-validator-extended-syntax/health.svg)](https://phpackages.com/packages/jedrzej-validator-extended-syntax)
```

###  Alternatives

[propaganistas/laravel-phone

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

3.0k39.7M146](/packages/propaganistas-laravel-phone)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel

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

Data Transfer Objects with validation for Laravel applications

762649.9k18](/packages/wendelladriel-laravel-validated-dto)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)

PHPackages © 2026

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