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

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

nwilging/laravel-strict-types-validation
========================================

A validator for laravel to require strict types in form request data

1.0.0(4y ago)31.7k1MITPHPPHP &gt;=7.4

Since May 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/nwilging/laravel-strict-types-validation)[ Packagist](https://packagist.org/packages/nwilging/laravel-strict-types-validation)[ RSS](/packages/nwilging-laravel-strict-types-validation/feed)WikiDiscussions develop Synced today

READMEChangelog (1)DependenciesVersions (3)Used By (0)

Strict Types Form Request Validation
====================================

[](#strict-types-form-request-validation)

[![Tests](https://github.com/nwilging/laravel-strict-types-validation/actions/workflows/main-branch.yml/badge.svg?branch=main)](https://github.com/nwilging/laravel-strict-types-validation/actions/workflows/main-branch.yml/badge.svg?branch=main)[![Coverage](./.github/coverage-badge.svg)](./.github/coverage-badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/ddb43303d39eded7cfc9114f4bf03305c8c00478458903ecac32b6c409b11815/687474703a2f2f706f7365722e707567782e6f72672f6e77696c67696e672f6c61726176656c2d7374726963742d74797065732d76616c69646174696f6e2f76)](https://packagist.org/packages/nwilging/laravel-strict-types-validation)[![License](https://camo.githubusercontent.com/72a76391d9d1f871427f6bc909ae070a79b533c5110410a02f99c60d0968c471/687474703a2f2f706f7365722e707567782e6f72672f6e77696c67696e672f6c61726176656c2d7374726963742d74797065732d76616c69646174696f6e2f6c6963656e7365)](https://packagist.org/packages/nwilging/laravel-strict-types-validation)[![Total Downloads](https://camo.githubusercontent.com/def9f6f0460c455ba48cac1421ad6eeec5041e982c908f95ea08c4c85ebcbd6e/687474703a2f2f706f7365722e707567782e6f72672f6e77696c67696e672f6c61726176656c2d7374726963742d74797065732d76616c69646174696f6e2f646f776e6c6f616473)](https://packagist.org/packages/nwilging/laravel-strict-types-validation)

Ensures incoming form request data is of a certain datatype.

---

### About

[](#about)

While Laravel includes many useful validation rules out of the box, [it lacks the ability to validate *data type* as well as *content type*](https://laravel.com/docs/9.x/validation#rule-integer). There have been a [couple](https://github.com/laravel/framework/issues/18918)[complaints](https://github.com/laravel/ideas/issues/1719) about this over the years, but due to the versatile nature of Laravel, it doesn't seem likely that validation rules such as `integer` or `boolean` will begin validating that the data is actually of the desired type.

This package provides a way for you to require the incoming data to be of a given type, such as `int`, `bool`, `float`, etc.

---

Installation
============

[](#installation)

### Pre Requisites

[](#pre-requisites)

1. Laravel v8+
2. PHP 7.4+

### Install with Composer

[](#install-with-composer)

```
composer require nwilging/laravel-strict-types-validation

```

---

Usage
=====

[](#usage)

When constructing validation rules, simply add `type:` to the validation rules string/array.

```
$rules = [
    'id' => 'required|type:int', # This will require the incoming `id` to be an integer.
];

```

### Failure Messages

[](#failure-messages)

The failure message format is:

```
The :attribute must be of type :type

```

Where `attribute` is the attribute being validated (`id` from the above example) and `type` is the desired type to validate against (`int` in the above example).

If the above example failed, we would receive this message:

```
The id must be of type int

```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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

1501d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b389be098fdc199f34b8fd5fb33efc50eb2bc523f23a903e5d28a3dce1dbac0?d=identicon)[nwilging](/maintainers/nwilging)

---

Top Contributors

[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")[![nwilging](https://avatars.githubusercontent.com/u/44447928?v=4)](https://github.com/nwilging "nwilging (1 commits)")

### Embed Badge

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

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

###  Alternatives

[marcosh/php-validation-dsl

A DSL for validating data in a functional fashion

483.9k](/packages/marcosh-php-validation-dsl)

PHPackages © 2026

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