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

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

joelharkes/laravel-strict-validation
====================================

Typesafe validation rules for laravel

0.0.1(3y ago)06[2 issues](https://github.com/joelharkes/laravel-strict-validation/issues)MITPHPPHP ^8.1CI failing

Since Apr 7Pushed 1y ago1 watchersCompare

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

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

Laravel Strict validation 📬
===========================

[](#laravel-strict-validation-)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7e2790f945ad1646a6559b534f2172dc27082205e9840228278a1c68233c5b12/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f656c6861726b65732f6c61726176656c2d7374726963742d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/joelharkes/laravel-strict-validation)[![Build status](https://github.com/joelharkes/laravel-strict-validation/actions/workflows/CI.yml/badge.svg)](https://github.com/joelharkes/laravel-strict-validation/actions/workflows/CI.yml)[![Total Downloads](https://camo.githubusercontent.com/dac2b81fbc5edd73ee9c886bc65c597979fe7e92e4a5e14a2c57f1304170713b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f656c6861726b65732f6c61726176656c2d7374726963742d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/joelharkes/laravel-strict-validation)

```
$data = $request->validate(['input' => [new ValidFloat()]);
is_float($data['input']); // true, even when input was "10" string.
```

If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming [PHP Package Development](https://phppackagedevelopment.com) video course.

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

[](#installation)

You can install the package via composer:

```
composer require joelharkes/laravel-strict-validation
```

### Usage

[](#usage)

```
$this->validate($request, ['input' => [new ValidFloat()]); // input is always float
$this->validate($request, ['input' => [new ValidCarbon()]); // input is always CARBON
```

### Available Rules:

[](#available-rules)

```
namespace Joelharkes\LaravelStrictValidation\Rules;
new ValidDatetime();
new ValidDecimal($digits, $decimals);
new ValidFloat();
new ValidIn(['option1', 'option2']); // make sure value is exactly the same as in the given array.
new ValidInteger();
```

-
- ValidDatetime
- ValidDate

### Make your own rule

[](#make-your-own-rule)

Making your own typesafe rule is easy. Just extend the `BaseRule` and implement the `validate` method. Call `$this->modifyValue($value)` to modify the value.

```
class YourRule extends \Joelharkes\LaravelStrictValidation\Rules\BaseRule
{
    public function validate(string $attribute, mixed $value, \Closure $fail): void
    {
        if (isNotValid($value)) {
            return $fail($attribute, $this->translate('validation.numeric'));
        }
        // when data is valid, but not in right type:
        $this->modifyValue(castToYourType($value));
    }
}
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Unknown

Total

1

Last Release

1131d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2989056e74eadea458ddd0f11667cd226c99f909b93ccd10541fa0c34a302d3b?d=identicon)[joelharkes](/maintainers/joelharkes)

---

Top Contributors

[![joelharkes](https://avatars.githubusercontent.com/u/2960938?v=4)](https://github.com/joelharkes "joelharkes (38 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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