The core feature of this bundle, the below attributes mainly exist to facilitate handling requests and responses.
RequestBody
This attribute is one with the most features in it. It decodes the request message body and passes it to a method argument in a controller. It supports scalars, objects, collections, and file-based method arguments.
Scalars
For scalar method arguments the ConverterManager is used if necessary.
Unfortunately, at the current state, PHP does not support declaring a collection with the desired type. In order to achieve that, the type parameter has been provided. It accepts types of well-known syntax type[].
When the request message body contains a file, you can declare your method argument as UploadedFile, File, SplFileInfo or SplFileObject. Thanks to the TmpFileUtils you can query those objects for any public method like getFilename(), getPathname() and so on.
It's a bit a special one, it covers all public methods like getClientOriginalName() or getClientMimeType().
The getClientOriginalName() uses the Content-Disposition header. In general, this header is used in responses and in multipart/form-data requests. For this to work, the Content-Disposition must be set to inline, and the filename parameter must be provided.
On the contrary, the getClientMimeType() uses the Content-Type header.
POST /pictures HTTP/1.1
Content-Type: image/png
Content-Disposition: inline; filename=foo.png
It binds a request parameter to a method argument in a controller. It supports multipart/form-data requests and that means you can even access a file through this attribute.
If a method argument cannot be nullable, and a query parameter cannot be found, a 400 HTTP response is returned.
QueryParams
It is similar to the @QueryParam, but instead of a single query parameter, it takes all query parameters to pass them as a single method argument in a controller. This attribute requires an argument to be of an object type.