Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages showcasing Symfony with Docker, APIs, queues & async tasks, Webpack, SPAs, etc.

Full default annotations

2.x version
Maintained Unmaintained
2.7

Full default annotations

Param fetcher

QueryParam

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
use FOS\RestBundle\Controller\Annotations\QueryParam;

/**
 * @QueryParam(
 *   name="",
 *   key=null,
 *   requirements="",
 *   incompatibles={},
 *   default=null,
 *   description="",
 *   strict=false,
 *   map=false,
 *   nullable=false
 * )
 */

RequestParam

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
use FOS\RestBundle\Controller\Annotations\RequestParam;

/**
 * @RequestParam(
 *   name="",
 *   key=null,
 *   requirements="",
 *   default=null,
 *   description="",
 *   strict=true,
 *   map=false,
 *   nullable=false
 * )
 */

FileParam

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
use FOS\RestBundle\Controller\Annotations\FileParam;

/**
 * @FileParam(
 *   name="",
 *   key=null,
 *   requirements={},
 *   default=null,
 *   description="",
 *   strict=true,
 *   nullable=false,
 *   image=false
 * )
 */

View

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
use FOS\RestBundle\Controller\Annotations\View;

/**
 * @View(
 *  templateVar="",
 *  statusCode=null,
 *  serializerGroups={},
 *  populateDefaultVars=true,
 *  serializerEnableMaxDepthChecks=false
 * )
 */

Routing

Route

RestBundle extends the @Route Symfony annotation. The following are shortcuts to define routes limited to a specific HTTP method: @Delete, @Get, @Head, @Link, @Patch, @Post, @Put, @Unlink, @Lock, @Unlock, @PropFind, @PropPatch, @Move, @Mkcol, @Copy. All of them have the same options as @Route.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.