Download the PHP package crtl/request-dto-resolver-bundle without Composer

On this page you can find all versions of the php package crtl/request-dto-resolver-bundle. 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 request-dto-resolver-bundle

crtl/request-dto-resolver-bundle

codecov Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

A Symfony bundle for predictable, type-safe instantiation and validation of request DTOs.

It removes boilerplate from controllers while staying close to Symfony’s native validation and argument resolving mechanisms.

Features

Installation

`

Configuration

Register the bundle in your Symfony application:

Bundle Options

The bundle exposes two options under the crtl_request_dto_resolver key:

Option Type Default Description
default_strict bool true Controls how property values are assigned during hydration. When true, values are assigned directly ($object->prop = $value), which enforces PHP's native type checks. When false, values are assigned via reflection, allowing implicit type coercion.
default_null bool false When true, properties that are missing from the request are treated as if null was sent. For non-nullable properties this produces a type constraint violation; for nullable properties the value is skipped as usual.

These serve as bundle-level defaults. Individual DTOs can override them via the #[RequestDto] attribute:

When the attribute parameter is omitted (or explicitly set to null), the bundle-level default is used.

Usage

Step 1: Define a Request DTO

Create a DTO class and annotate it with #[RequestDto]. Use parameter attributes to map request data to properties.

The attribute is required to identify which controller arguments should be resolved and validated.

1.1 Strictly typed DTO

Any type mismatches will trigger a constraint violation and thus a RequestValidationException is thrown.

1.2 Mixed typed DTO

1.3 Important notes about DTO hydration

1.4 Validation group sequences

All Symfony validation group sequence variants are supported.

Because request data can never be trusted, DTO properties may be uninitialized regardless of whether strict typing is used or not.
Missing or invalid input can prevent a property from being assigned during hydration.

When using validation group sequences, you must therefore ensure that properties are accessed safely by:

Failing to do so may lead to runtime errors before later validation groups are evaluated.

Step 2: Use the DTO in a Controller


Handling Validation Errors

On validation failure, a RequestValidationException is thrown.

The bundle registers a default exception subscriber (priority -32) that returns a 400 Bad Request JSON response.

You can override this with your own listener:

License

This bundle is licensed under the MIT License. See the LICENSE file for details.


All versions of request-dto-resolver-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
symfony/http-kernel Version ^7.2 | ^8.0
symfony/validator Version ^7.2 | ^8.0
symfony/dependency-injection Version ^7.2 | ^8.0
symfony/property-info Version ^7.2 | ^8.0
symfony/cache Version ^7.1 | ^8.0
symfony/framework-bundle Version ^7.1 | ^8.0
psr/log Version ^3.0
phpdocumentor/reflection-docblock Version ^5.6
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 crtl/request-dto-resolver-bundle contains the following files

Loading the files please wait ...