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

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

juststeveking/fluent-validation
===============================

Fluent Validation is a helper package, that allows you to use sensible defaults for your Laravel validation rules.`

0.0.2(3y ago)255682MITPHPPHP ^8.1

Since Nov 9Pushed 3y ago1 watchersCompare

[ Source](https://github.com/JustSteveKing/fluent-validation)[ Packagist](https://packagist.org/packages/juststeveking/fluent-validation)[ GitHub Sponsors](https://github.com/JustSteveKing)[ RSS](/packages/juststeveking-fluent-validation/feed)WikiDiscussions main Synced 1mo ago

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

Fluent Validation
=================

[](#fluent-validation)

[![Latest Version on Packagist](https://camo.githubusercontent.com/29c06db8ec49ee92f8ae50d9c1423e99c3bde3d1834e5298b54d69e4bf60555b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a75737473746576656b696e672f666c75656e742d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juststeveking/fluent-validation)[![Test Suite](https://github.com/juststeveking/fluent-validation/actions/workflows/tests.yml/badge.svg)](https://github.com/juststeveking/fluent-validation/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/8c07551b0c521ad2f6d4debcedef7129d7d448160c496b22fd84324a273c5714/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a75737473746576656b696e672f666c75656e742d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juststeveking/fluent-validation)

Fluent Validation is a helper package, that allows you to use sensible defaults for your Laravel validation rules.

Installation
------------

[](#installation)

```
composer require juststeveking/fluent-validation
```

Why??
-----

[](#why)

Why did I create this package? Well to be honest, I was feeling lazy - but a productive kind of lazy. I was writing some validation for quite a large API request and looked at all the string input I was about to have to validate, and thought there must be an easier way. So I created this to save me time by taking time building a package. I got the last laugh though, as now I never have to write the same string validation again!

Usage
-----

[](#usage)

To use this package all you need to do is include the rules you may wish to use:

### Validating emails

[](#validating-emails)

```
return [
    'email' => \JustSteveKing\FluentValidation\Fluency\EmailRule::rules()
];
```

Or to build them up yourself and/or override them:

```
return [
    'email' => [
        \JustSteveKing\FluentValidation\Rules\Required::rule(),
        \JustSteveKing\FluentValidation\Rules\Email::rule('rfc,dns'),
    ]
];
```

### Validating Passwords

[](#validating-passwords)

```
return [
    'password' => \JustSteveKing\FluentValidation\Fluency\PasswordRule::rules()
];
```

Or to build them up yourself and/or override them:

```
return [
    'password' => [
        \JustSteveKing\FluentValidation\Rules\Required::rule(),
        \Illuminate\Validation\Rules\Password::default(),
    ]
];
```

### Validating Strings

[](#validating-strings)

```
return [
    'title' => \JustSteveKing\FluentValidation\Fluency\StringRule::rules()
];
```

Or to build them up yourself and/or override them:

```
return [
    'title' => [
        \JustSteveKing\FluentValidation\Rules\Required::rule(),
        \JustSteveKing\FluentValidation\Rules\Text::rule(),
        \JustSteveKing\FluentValidation\Rules\Min::rule(2),
        \JustSteveKing\FluentValidation\Rules\Max::rule(255),
    ]
];
```

Available Fluency Rules
-----------------------

[](#available-fluency-rules)

This is a list of the currently available Fluency Rules:

- `EmailRule` - Will return `required` and `email` rules.
- `PasswordRule` - Will return `required` and `Password::default()` rules from Laravel.
- `StringRule` - Will return `required`, `min:2`, and `max:255` rules.

Available Rules
---------------

[](#available-rules)

This is a list of the currently available Rules:

- `Accepted` - Will return `accepted` or whatever override input you pass.
- `After` - Will return `after:` and whatever override input you pass.
- `AfterOrEqual` - Will return `after_or_equal:` and whatever override input you pass.
- `Alpha` - Will return `alpha` or whatever override input you pass.
- `Boolean` - Will return `boolean` or whatever override input you pass.
- `Date` - Will return `date` or whatever override input you pass.
- `Email` - Will return `email:` and whatever override input you pass.
- `Enum` - Will return a new Laravel Enum validation rule, you *must* pass a backed Enum to this instance using `YourEnum::class`.
- `Exists` - Will return `exists:` with whatever table and an optional column you pass to it.
- `Integer` - Will return `integer` or whatever override input you pass.
- `Max` - Will return `max:` and whatever override input you pass.
- `Min` - Will return `min:` and whatever override input you pass.
- `Required` - Will return `required` or whatever override input you pass.
- `Text` - Will return `string` or whatever override input you pass.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Steve McDougall](https://github.com/juststeveking)
- [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

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

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

2

Last Release

1275d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/juststeveking-fluent-validation/health.svg)](https://phpackages.com/packages/juststeveking-fluent-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)
