Download the PHP package respect/fluentgen without Composer

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

Respect\FluentGen

Generate PHP mixin interfaces from class namespaces, so IDEs can autocomplete __call-based fluent builder chains.

When a builder resolves method calls dynamically, IDEs can't see the available methods. FluentGen solves this by scanning your classes, reflecting their constructors, and generating interface files that declare every method with proper signatures and return types. Your builder class then references the generated interface via a @mixin docblock, and autocompletion works.

FluentGen works with any class namespace that follows a naming convention. If your classes use the #[Composable] attribute from Respect/Fluent, FluentGen additionally generates per-prefix composed interfaces, but that is not required.

Installation

Requires PHP 8.5+.

What it generates

Given a namespace full of classes like AreaFormatter, DateFormatter, MaskFormatter, FluentGen produces two interfaces:

Each generated method mirrors the constructor signature of the underlying class. If MaskFormatter has __construct(string $range, string $replacement = '*'), the generated mask() method has the same parameters. Doc comments on the constructor are carried over too.

Setting it up

FluentGen is typically wired into a Symfony Console command that you run during development. Here's how it looks like:

First, configure what to scan and where to write:

sourceDir and sourceNamespace tell the scanner where your classes live. outputDir and outputNamespace control where the generated interfaces go.

Next, set up scanning. The NamespaceScanner reflects every concrete class in the directory. You can filter by interface and exclude specific classes:

Without filters, the scanner picks up every non-abstract class it finds. The nodeType filter restricts to classes implementing a given interface. The exclusion list removes specific classes by short name, useful for excluding the builder class itself if it lives in the same namespace.

Then configure the generator. MixinGenerator needs to know what interfaces to produce. Each InterfaceConfig describes one:

The suffix determines the interface name. The returnType is what every generated method returns, typically your Chain interface, enabling fluent chaining. Set static: true for the builder entry point. Use rootExtends when the chain interface should extend your domain interface.

The MethodBuilder handles how class names map to method names. The classSuffix option strips a suffix before generating: AreaFormatter becomes area(), DateFormatter becomes date().

Finally, call generate() to get a filename-to-content map:

Run this as part of your dev tooling: a console command, a Composer script, or CI check that verifies generated files are up to date.

Composition support (optional, requires Respect/Fluent)

Some libraries, like Respect/Validation, use prefix composition where notEmail() creates Not(Email()). If your classes use the #[Composable] attribute from Respect/Fluent, FluentGen handles this automatically.

Install the optional dependency:

The MixinGenerator discovers composable prefixes and generates per-prefix interfaces. For example, a Not class with #[Composable(self::class)] produces a NotBuilder interface containing notEmail(), notString(), etc., and a root Builder interface that extends all prefix interfaces.

Composition constraints (without, with, optIn on the Composable attribute) are respected during generation. Forbidden combinations are excluded from the generated interfaces.

For the runtime prefix map, PrefixConstantsGenerator produces a constants class with COMPOSABLE, COMPOSABLE_WITH_ARGUMENT, and FORBIDDEN arrays that ComposableMap uses at resolve time.

Customization

MethodBuilder controls how constructor parameters become method signatures. Beyond classSuffix, it supports excludedTypePrefixes and excludedTypeNames to skip parameters whose types come from external packages you don't want in your public interface.

FileRenderer handles the final output, printing the generated namespace via Nette PHP Generator and applying the OutputFormatter. The formatter preserves existing SPDX license headers, converts tabs to spaces, normalizes nullable syntax (?Type becomes Type|null), and collapses single-line doc comments. Both are used with sensible defaults; you rarely need to customize them.

InterfaceConfig has a few more options for the root interface: rootComment adds a docblock (like @mixin FormatterBuilder), rootUses adds use statements, and rootExtends makes the interface extend others.


All versions of fluentgen with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
nette/php-generator Version ^4.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 respect/fluentgen contains the following files

Loading the files please wait ...