Download the PHP package respect/fluent-analysis without Composer

On this page you can find all versions of the php package respect/fluent-analysis. 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 fluent-analysis

Respect\FluentAnalysis

PHPStan extension for Respect/Fluent builders. Provides method resolution, parameter validation, tuple-typed getNodes(), and type narrowing through assertion methods.

Fluent builders use __call to resolve method names to class instances. Since those methods don't exist as real declarations, PHPStan reports errors and can't validate arguments. This extension teaches PHPStan what each method does: its parameters, return type, and the exact tuple of accumulated nodes.

Installation

Requires PHP 8.5+ and PHPStan 2.1+.

Setup

Libraries that ship a Fluent builder declare it in their fluent.neon:

The extension loads automatically via phpstan/extension-installer. Method maps are built from #[FluentNamespace] attributes at PHPStan boot.

Adding custom namespaces

To add extra node namespaces to an existing builder (e.g. custom validators):

Entries from multiple neon files are merged automatically. Each package, extension, or user project can append entries independently.

Generating config for new projects

For projects that define their own #[FluentNamespace] builders:

This scans your composer.json autoload entries for builder classes and writes a fluent.neon with the builder list and service registrations.

Features

Method resolution

Every method on your builder is resolved to its target class. PHPStan reports unknown methods as errors: typos are caught at analysis time.

Constructor parameter forwarding

Method parameters come from the target class constructor. If Cors has __construct(string $origin = '*'), then ->cors() accepts the same signature. Type mismatches are reported.

Tuple-typed getNodes()

The extension tracks which node types are accumulated through the chain. getNodes() returns a precise tuple instead of array<int, object>:

Tuple tracking works through variable assignments and static calls:

Deprecation forwarding

If a target class is marked @deprecated, the fluent method inherits the deprecation. PHPStan reports it wherever the method is called.

Composable prefix support

For builders using Respect/Fluent's composable prefixes (like Validation's notEmail(), nullOrStringType()), the extension resolves composed methods with correct parameter signatures.

Type narrowing

Builders can narrow the type of a variable through assertion methods. Node classes declare their assurance via the #[Assurance] attribute, assertion methods are marked with #[AssuranceAssertion], and #[AssuranceParameter] identifies the validated parameter and constructor parameters used for type resolution.

Void assertion methods narrow unconditionally:

Bool assertion methods work as type guards:

Chained nodes intersect their assurances:

The extension supports several assurance modes through the #[Assurance] attribute:

How it works

The extension registers three PHPStan hooks:

  1. FluentMethodsExtension (MethodsClassReflectionExtension) — tells PHPStan which methods exist on each builder, with parameters extracted from the target class constructor.

  2. FluentDynamicReturnTypeExtension (DynamicMethodReturnTypeExtension + DynamicStaticMethodReturnTypeExtension) — intercepts each method call to track accumulated node types as a GenericObjectType wrapping a ConstantArrayType tuple. When getNodes() is called, the tuple is returned directly. Also accumulates assurance types through the chain.

  3. FluentTypeSpecifyingExtension (MethodTypeSpecifyingExtension) — enables type narrowing in control flow. When a builder's assertion method is called, accumulated assurances are applied to narrow the input variable's type. Supports void assertions (unconditional) and bool guards (conditional).

The extensions share a MethodMap for method resolution and an AssuranceMap for type narrowing configuration, both with parent-class fallback for builder inheritance.

At PHPStan boot, MethodMapFactory reads the builders parameter, reflects each builder's #[FluentNamespace] attribute, discovers classes in the declared namespaces, and builds the method/assurance maps. Extra namespaces from user config are merged via withNamespace().

FluentAnalysis vs FluentGen

Another similar project is FluentGen.

Both are complementary, offering IDE support and type inference as separate packages.

FluentAnalysis FluentGen
Generated files None Interface files per builder + prefix
Return type Builder<array{A, B, C}> Builder (via @mixin)
getNodes() type array{A, B, C} (exact tuple) array<int, Node> (generic)
Element access $nodes[0] typed as A mixed
Deprecation Forwarded automatically Must regenerate
Composable prefixes Resolved from attribute Full method signatures
Type narrowing Assertion methods narrow input types Not supported
IDE support PHPStan-powered (PhpStorm, VS Code) Direct IDE autocomplete

All versions of fluent-analysis with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
phpstan/phpstan Version ^2.1
respect/fluent Version ^2.0
symfony/console Version ^6.0|^7.0
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 respect/fluent-analysis contains the following files

Loading the files please wait ...