PHPackages                             elao/json-http-form-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. elao/json-http-form-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

elao/json-http-form-bundle
==========================

Adds support of JSON requests for Forms

v3.1.0(2y ago)356.0k4MITPHPPHP ^7.4|^8.0

Since Apr 20Pushed 2y ago15 watchersCompare

[ Source](https://github.com/Elao/ElaoJsonHttpFormBundle)[ Packagist](https://packagist.org/packages/elao/json-http-form-bundle)[ Docs](https://github.com/Elao/ElaoJsonHttpFormBundle.git)[ RSS](/packages/elao-json-http-form-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (9)Versions (10)Used By (0)

Elao JSON HTTP Form Bundle [![](https://camo.githubusercontent.com/2f6f8a254b3dc7830bd289e410540c9828207fd35d35fd7cbf419db164ea7a0b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d352e332d626c75652e737667)](https://camo.githubusercontent.com/2f6f8a254b3dc7830bd289e410540c9828207fd35d35fd7cbf419db164ea7a0b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d352e332d626c75652e737667)
================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#elao-json-http-form-bundle-)

[![Build Status](https://camo.githubusercontent.com/0d685493732671fba99ce25344b857a416003a05e2a1a40ff530ece9acf9eff4/68747470733a2f2f7472617669732d63692e6f72672f456c616f2f456c616f4a736f6e48747470466f726d42756e646c652e737667)](https://travis-ci.org/Elao/ElaoJsonHttpFormBundle)

Adds support of JSON requests for Forms:

Symfony forms will be able to handle both JSON POST/PUT/PATCH/DELETE requests and standard GET/POST requests (as they are by default).

The `JsonHttpFoundationRequestHandler` handles the request: If the request content-type is JSON, it decodes the JSON request content as an array and submits the form with its data.

Otherwise, it lets the default behaviour operate: the `HttpFoundationRequestHandler` will handle the request. So all your non-json form request will be treated just the way they've always been.

Installation
------------

[](#installation)

Require *ElaoJsonHttpFormBundle*:

```
composer require elao/json-http-form-bundle
```

Usage
-----

[](#usage)

Given a `Rocket` entity with two attributes: `name` (a string) and `colors` (an array of strings).

The following form and controller are meant to create a new instance of Rocket:

```
