PHPackages                             ambelz/json-to-form - 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. [Templating &amp; Views](/categories/templating)
4. /
5. ambelz/json-to-form

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

ambelz/json-to-form
===================

Symfony bundle to transform JSON structures into forms

v0.6.6(2mo ago)135Apache-2.0PHPPHP &gt;=8.2

Since Jun 21Pushed 2mo agoCompare

[ Source](https://github.com/ambelz/json-to-form)[ Packagist](https://packagist.org/packages/ambelz/json-to-form)[ RSS](/packages/ambelz-json-to-form/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (12)Used By (0)

JSON to Form Bundle
===================

[](#json-to-form-bundle)

**Author:** Christophe Abillama

Symfony bundle to transform JSON structures into forms.

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

[](#installation)

```
composer require ambelz/json-to-form
```

Add the bundle in `config/bundles.php`:

```
return [
    // ...
    Ambelz\JsonToFormBundle\JsonFormBundle::class => ['all' => true],
];
```

Quick Start
-----------

[](#quick-start)

For quick usage, you only need **3 elements**:

### 1. 📋 A JSON structure that follows the format

[](#1--a-json-structure-that-follows-the-format)

> **Documentation:** For detailed structure documentation and examples, see [STRUCTURE.md](STRUCTURE.md)

File name: `my-form.json`Place the JSON file in `config/forms/` directory.

```
{
  "slug": "my-simple-form",
  "sections": [
    {
      "slug": "basic-info",
      "title": "Basic Information",
      "categories": [
        {
          "slug": "contact",
          "title": "Contact",
          "questions": [
            {
              "key": "name",
              "type": "text",
              "label": "Your Name",
              "required": true
            }
          ]
        }
      ]
      // Submit button will be default if not specified
      // See STRUCTURE.md for submit button configuration
    }
  ]
}
```

### 2. 🎛️ A classic controller that loads JSON and renders the main view

[](#2-️-a-classic-controller-that-loads-json-and-renders-the-main-view)

```
