# Strict Request Input Casting in Laravel

DevFeed: [Strict Request Input Casting in Laravel](<https://devfeed.tech/articles/strict-request-input-casting-in-laravel-121229.md>)

Original publisher: [Read original article](<https://laravel-news.com/laravel-strict-request-input>)

Author: Paul Redmond

Published: 2026-11-05T01:18:05Z

Content type: article

Language: en

Sources: [Laravel](<https://devfeed.tech/sources/laravel.md>)

Topics: [Laravel](<https://devfeed.tech/topics/laravel.md>), [input](<https://devfeed.tech/topics/input.md>), [Error Handling](<https://devfeed.tech/topics/error-handling.md>), [Sanitization](<https://devfeed.tech/topics/sanitization.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [arrays](<https://devfeed.tech/tags/arrays.md>), [boolean](<https://devfeed.tech/tags/boolean.md>), [cast](<https://devfeed.tech/tags/cast.md>), [error](<https://devfeed.tech/tags/error.md>), [flag](<https://devfeed.tech/tags/flag.md>), [form](<https://devfeed.tech/tags/form.md>), [handling](<https://devfeed.tech/tags/handling.md>), [input](<https://devfeed.tech/tags/input.md>), [json](<https://devfeed.tech/tags/json.md>), [laravel](<https://devfeed.tech/tags/laravel.md>), [laravel-tutorials](<https://devfeed.tech/tags/laravel-tutorials.md>), [name](<https://devfeed.tech/tags/name.md>), [request](<https://devfeed.tech/tags/request.md>), [string](<https://devfeed.tech/tags/string.md>)

## AI overview

Laravel 13.40 adds `strict: true` to request `integer()`, `boolean()`, `float()`, and `string()` helpers (and the `str()` alias). Strict mode validates values before casting and returns the supplied default for invalid input, avoiding cases where malformed input becomes `0` or an array-to-string error. Rules differ by type: integers reject decimals, leading zeros, and out-of-range values; floats accept whole numbers and exponent notation; booleans recognize true/false forms and otherwise use the default; strings reject arrays, booleans, and null, with empty input also falling back. Defaults may be closures or `null`, and are returned without casting. The flag is also available on other classes using `InteractsWithData`. Since strict mode silently falls back without reporting invalid input, the article recommends validation when bad or missing values should produce an error users can correct.

## Source excerpt

Laravel 13.40 adds a strict flag to the request integer(), boolean(), float(), and string() helpers, so bad input returns your default instead of 0 or an error. The post Strict Request Input Casting in Laravel appeared first on Laravel News. Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.