Download the PHP package jbboehr/phpstan-laravel-validation without Composer

On this page you can find all versions of the php package jbboehr/phpstan-laravel-validation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpstan-laravel-validation

phpstan-laravel-validation

ci License: AGPL v3+ stability-experimental AI burn

[!CAUTION]

CONSIDER AN ALTERNATIVE FOR NEW CODE

Laravel validation is not a typed data boundary. Successful validation commonly preserves original values rather than producing the native PHP types suggested by rule names. Presence conditions, cross-field rules, wildcards, exclusions, and nested projection can also change the returned shape in surprising ways.

phpstan-laravel-validation aims to recover sound and useful structural types from that behavior. Some inferred types are necessarily broader than expected because they describe what Laravel can actually return.

For new type-conscious code, consider a boundary with an explicit, normalized output contract, such as cuyz/valinor, typed DTOs, schema objects, or explicit parsers.

See Laravel validation and type safety for verified examples and the detailed rationale.

This library is a mitigation, not an endorsement of Laravel validation for new code.

Should I use it?

Use this extension when an existing application already validates with Laravel and you want PHPStan to describe the successful validated() shape honestly.

Do not use it as a reason to keep Laravel validation as the typed boundary for new code. Prefer an explicit, normalized output contract there. This package is a mitigation layer.

What this extension does

For supported, statically resolvable rule expressions, this PHPStan 2.x extension infers a sound type for Laravel's validated output. Every successful Laravel value must be a subtype of that type. The inferred type may be broader than a rule name suggests because Laravel preserves input types and can produce dynamic output shapes.

The explicit person rule makes that offset required. Without it, wildcard rules only constrain matching elements, so the inferred shape uses person?.

The same rule-set inference applies to factory make() / validate(), Request::validate(), and controller validate(). Dynamic or unpacked rule sets retain Laravel's broad declared return types.

A successful direct facade or Factory::validate() call can also refine safe top-level fields on the caller's original array. That is an input constraint, not a claim that the array was replaced by validated() output. Details are in Supported Entry Points.

Installation

Requires PHP 8.1. Supported on PHP 8.1 through 8.5, PHPStan 2.1.5 or later, and Laravel 10 through 13.

If your application uses the experimental jbboehr\Rensei\Parse runtime, install this package without --dev so it remains available in production. See Parsing Validated Output for installation details and runtime requirements.

If you also install phpstan/extension-installer, the extension is registered automatically.

Otherwise include extension.neon in your PHPStan config:

Configuration

Defaults match Laravel's ordinary factory and validator behavior. Most projects can start with no extra options.

Set laravelVersion explicitly when PHPStan's working directory is not the Composer project that owns Laravel. Opt into assumeHttpInputNormalization only when request validation always runs after Laravel's default trim/empty-string middleware. FormRequest inference and definite conditional-presence inference are experimental and off by default.

The full option list is in Configuration.

Status

The 0.1 line is an experimental public release.

Sound inferred types may be broader than rule names suggest. Dynamic rule construction, callbacks, and custom rules without an accurate static contract stay conservative. See Limitations and Laravel Version Behavior.

Documentation

The published book is https://jbboehr.github.io/phpstan-laravel-validation/. Source pages live under docs/pages/:

Development

See Development and CONTRIBUTING.md.

License

This project is licensed under the AGPL v3+ License - see the LICENSE.md file for details.


All versions of phpstan-laravel-validation with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
composer-runtime-api Version ^2.1
phpstan/phpstan Version ^2.1.5
nikic/php-parser Version ^4.15 || ^5.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jbboehr/phpstan-laravel-validation contains the following files

Loading the files please wait ...