Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
\#\[.*(Get|Post|Delete|Put).*\((.*)\)
/
gm

Description

Substitute AbstractFOSRestController Routing attributes by Symfony Routing attribute #[Route]

move HTTP method to methods:['<http_method>'] and use #[Route] attribute

  • #[Rest\Get('/corbeilles')]
  • #[Rest\Post('/corbeille/restore')]
  • #[Rest\Delete(path: '/chapitres/{id}', requirements: ['id' => '\d+'])]
  • #[Rest\Delete(path: '/livres/{id}', name: 'app_livre_delete', requirements: ['id' => '\d+'])]
  • #[Get(path: '/etageres/{id}')
Submitted by anonymous - 2 years ago