PHPackages                             trueifnotfalse/lumen-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. trueifnotfalse/lumen-strict-types-validation

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

trueifnotfalse/lumen-strict-types-validation
============================================

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

1.0.0(2y ago)08.8kMITPHPPHP &gt;=7.4

Since May 24Pushed 2y agoCompare

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

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

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

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

Ensures incoming form request data is of a certain datatype.

---

### About

[](#about)

While Lumen 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. Lumen v8+
2. PHP 7.4+

### Install with Composer

[](#install-with-composer)

```
composer require trueifnotfalse/lumen-strict-types-validation
```

Add to `bootstrap/app.php` and register the Service Provider.

```
    $app->register(TrueIfNotFalse\LumenStrictValidation\Providers\StrictValidationProvider::class);
```

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

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

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

999d ago

### Community

Maintainers

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

---

Top Contributors

[![trueifnotfalse](https://avatars.githubusercontent.com/u/34368359?v=4)](https://github.com/trueifnotfalse "trueifnotfalse (2 commits)")[![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)")

---

Tags

lumenlumen-frameworkstrict-typesvalidationvalidator

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[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)[xemlock/htmlpurifier-html5

HTML5 support for HTML Purifier

1052.9M11](/packages/xemlock-htmlpurifier-html5)

PHPackages © 2026

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