$form = $this->createFormBuilder() ->add('username', TextType::class) ->add('password', PasswordType::class) ->add('submit', SubmitType::class) ->getForm(); if ($request->isMethod('POST')) { $form->submit($request->request->get($form->getName())); if ($form->isValid()) { // Perform actions based on form data } }In the above example, we first create a form using the createFormBuilder method. The form has fields for username and password, as well as a submit button. When the form is submitted (as determined by the isMethod method), we call the submit method on the form object and pass in the data from the request. This method will validate the data and set the form's internal data to that data. Finally, we check whether the form is valid (using the isValid method) and perform any necessary actions based on the form data. The package library for this functionality is the Symfony form component, which is a part of the larger Symfony framework.