2017 © Pedro Peláez
 

symfony-bundle form-handler-bundle

Hostnet form handler to provide an easier way of handling forms in actions

image

hostnet/form-handler-bundle

Hostnet form handler to provide an easier way of handling forms in actions

  • Tuesday, January 30, 2018
  • by hostnet
  • Repository
  • 20 Watchers
  • 62 Stars
  • 37,329 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 11 Forks
  • 4 Open issues
  • 16 Versions
  • 9 % Grown

The README.md

, (*1)

The form handlers are designed to enhance the developer experience (DX) when working with Symfony forms. It makes the controllers simpler by moving the form success and failure flows to a separate class., (*2)

class YourController extends Controller
{
    public function formAction(Request $request, MyEntityUser $user)
    {
        $handler = $this->get('hostnet.form_handler.factory')->create(MyFormHandler::class);

        if (($response = $handler->handle($request, new MyFormData())) instanceof RedirectResponse) {
            return $response;
        }

        // regular or in-valid flow
        return $this->render->renderView('/your/form.html.twig', [
            'form' => $handler->getForm()->createView()
        ]);
    }
}

By extracting the success - and if available, the failure - flows, you reduce the amount of code in your controllers, which in turn, achieves slim controllers. The definition of a controller is according to Symfony: "a PHP function you create that reads information from the Symfony's Request object and creates and returns a Response object"., (*3)

Installation

Documentation

License

The hostnet/form-handler-bundle is licensed under the MIT License, meaning you can reuse the code within proprietary software provided that all copies of the licensed software include a copy of the MIT License terms and the copyright notice., (*4)

Get in touch

The Versions

08/02 2017

1.1.1

1.1.1.0

Hostnet form handler to provide an easier way of handling forms in actions

  Sources   Download

MIT

The Requires

 

The Development Requires

14/01 2016

1.1.0

1.1.0.0

Hostnet form handler to provide an easier way of handling forms in actions

  Sources   Download

MIT

The Requires

 

The Development Requires

15/07 2014

1.0.0

1.0.0.0

Hostnet form handler to provide an easier way of handling forms in actions

  Sources   Download

EPL-1.0

The Requires

 

The Development Requires

30/06 2014

0.1.0

0.1.0.0

Hostnet form handler to provide an easier way of handling forms in actions

  Sources   Download

EPL-1.0

The Requires

 

The Development Requires

16/06 2014

0.0.1

0.0.1.0

Hostnet form handler to provide an easier way of handling forms in actions

  Sources   Download

EPL-1.0

The Requires

 

The Development Requires