Download the PHP package flavacaster/symfony-http-bundle without Composer
On this page you can find all versions of the php package flavacaster/symfony-http-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download flavacaster/symfony-http-bundle
More information about flavacaster/symfony-http-bundle
Files in flavacaster/symfony-http-bundle
Package symfony-http-bundle
Short Description symfony http request validator bundle
License MIT
Informations about the package symfony-http-bundle
About
This package still under development.
Requests injection
How it works:
- You create request class, describe it structure with JMS serializer annotations and Symfony validation annotations.
- You inject request in your controller action.
- Bundle validates request according to your request class, if request is invalid, it throws custom validation exception.
- If request is valid, it is deserialized to your request class.
Important note: HTTP request fields always come as strings, to validate them correctly, they are soft casted according to type annotations in request class.
You can register listener, that will convert
Flavacaster\SymfonyHttpBundle\EventListener\RequestPayloadExceptionListener
exception to json
response:
Example:
Request class:
Controller action:
Response for request without parameters:
Nested objects and array of objects
Nested objects and arrays of objects are handled with Flavacaster/symfony-validators-bundle
package.
Example:
Arrays
One remark about arrays: arrays of integer/float/bool must have @var
annotation describing their inner
elements scalar type. It needed for soft type casting before validation. Available values: int[]
,
float[]
, boolean[]
, string[]
.
Example:
AllowExtraFields and AllowMissingFields
Validatior allowExtraFields
and allowMissingFields
parameters can be overwritten with annotations:
🥔
All versions of symfony-http-bundle with dependencies
symfony/http-foundation Version 6.2.*
symfony/validator Version 6.2.*
doctrine/annotations Version ^1.13
jms/serializer Version ^3.10
ext-json Version *
symfony/serializer Version 6.2.*
symfony/http-kernel Version 6.2.*
symfony/dependency-injection Version 6.2.*
symfony/config Version 6.2.*
flavacaster/symfony-validators-bundle Version 1.*