Skip to content

Symfony 7: Forms

DIY forms

  • use Symfony\Component\HttpFoundation\Request as controller method parameter;
  • read POST data: $request->request->get('submit');

Symfony forms

composer require symfony/form
# validator
composer require validator

Keep in mind

  • field type guessing;
  • form profiler;
  • data transformation (can also create a custom one);
  • select, checkbox, radio: ChoiceType;
  • select with options from db: EntityType;