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

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

micayael/form-generator-bundle
==============================

Bundle para el generar formularios mediante yaml y json

1.1.0(1mo ago)06.7k↓40%MITPHPPHP ^7.4|^8.0CI failing

Since Jan 11Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/micayael/form-generator-bundle)[ Packagist](https://packagist.org/packages/micayael/form-generator-bundle)[ RSS](/packages/micayael-form-generator-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (24)Versions (16)Used By (0)

micayael/form-generator-bundle
==============================

[](#micayaelform-generator-bundle)

[![Symfony 5](https://github.com/micayael/form-generator-bundle/actions/workflows/symfony5.yml/badge.svg)](https://github.com/micayael/form-generator-bundle/actions/workflows/symfony5.yml)[![Symfony 6](https://github.com/micayael/form-generator-bundle/actions/workflows/symfony6.yml/badge.svg)](https://github.com/micayael/form-generator-bundle/actions/workflows/symfony6.yml)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/c29d50992add9ce1241333166310ba1332e2ebbb3ec1171fecfe1bf3b4769762/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6963617961656c2f666f726d2d67656e657261746f722d62756e646c652f6261646765732f7175616c6974792d73636f72652e706e67)](https://scrutinizer-ci.com/g/micayael/form-generator-bundle/)[![Packagist](https://camo.githubusercontent.com/0a9f92d5c32c89bf8ba8535e2816e8e37334622c5f24f0d4e4896b8f2de08d41/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6963617961656c2f666f726d2d67656e657261746f722d62756e646c652e737667)](https://packagist.org/packages/micayael/form-generator-bundle)[![License](https://camo.githubusercontent.com/12065527ed5db91692acefdd750aca293377ab9d3854c0f5c0bdf780cc216c45/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6963617961656c2f666f726d2d67656e657261746f722d62756e646c652e737667)](https://camo.githubusercontent.com/12065527ed5db91692acefdd750aca293377ab9d3854c0f5c0bdf780cc216c45/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6963617961656c2f666f726d2d67656e657261746f722d62756e646c652e737667)[![Latest Stable Version](https://camo.githubusercontent.com/cf6d59114f6614fc1c7ed461660df397f74f446db5c9fd50b1db527ed779caf8/68747470733a2f2f706f7365722e707567782e6f72672f6d6963617961656c2f666f726d2d67656e657261746f722d62756e646c652f762f737461626c65)](https://packagist.org/packages/micayael/form-generator-bundle)[![Total Downloads](https://camo.githubusercontent.com/3bcfc6a5fc8bcd79b697a8c8111ec617c90ce5e8e42cdbe68a9d0c69c36b531e/68747470733a2f2f706f7365722e707567782e6f72672f6d6963617961656c2f666f726d2d67656e657261746f722d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/micayael/form-generator-bundle)[![PHP from Packagist](https://camo.githubusercontent.com/3236306138c295ffd093fc901efbe9c60c6b33d12df7b9d60f76cd35a219e692/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d6963617961656c2f666f726d2d67656e657261746f722d62756e646c652e737667)](https://packagist.org/packages/micayael/form-generator-bundle)

Introduction
------------

[](#introduction)

Allows you to generate Symfony forms using YAML, JSON or associative array configurations based on the standard configurations of the framework's forms component.

See:

It is based on the use of the add function of the form builder used to create forms with Symfony

1. el name para el input de formulario
2. el tipo de campo de formulario
3. un array de options para configurar este tipo de campo

```
// FormInterface::add($child, string $type = null, array $options = [])
$builder->add($inputName, $inputTypeClass, $inputOptions);
```

With this it is possible to create a YAML configuration, JSON or an associative array in which:

- the **key** represents the $inputName
- **type** represents a form $inputTypeClass supported by the
- bundle or the "fully qualified class name (FQN)" of a class form type
- the **options** array represents the form $inputOptions

This allows you to configure forms dynamically by using yaml, json or an associative array like the examples below:

### YAML

[](#yaml)

```
name:
birthday:
  type: date
  options:
    label: 'Your Birthday'
status:
  type: choice
  options:
    choices:
      Active: A
      Inactive: I
custom_type:
  type: App\Form\Type\CustomType
  options:
    custom_option: value
```

### JSON

[](#json)

```
{
  "name": null,
  "birthday": {
    "type": "date",
    "options": {
      "label": "Your Birthday"
    }
  },
  "status": {
    "type": "choice",
    "options": {
      "choices": {
        "Active": "A",
        "Inactive": "I"
      }
    }
  },
  "custom_type": {
    "type": "App\\Form\\Type\\CustomType",
    "options": {
      "custom_option": "value"
    }
  }
}
```

### PHP

[](#php)

```
$formConfig = [
  'name' => NULL,
  'birthday' => [
    'type' => 'date',
    'options' => [
      'label' => 'Your Birthday',
    ],
  ],
  'status' => [
    'type' => 'choice',
    'options' => [
      'choices' => [
        'Active' => 'A',
        'Inactive' => 'I',
      ],
    ],
  ],
  'custom_type' => [
    'type' => 'App\\Form\\Type\\CustomType',
    'options' => [
      'custom_option' => 'value',
    ],
  ],
]
```

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

[](#installation)

```
composer require micayael/form-generator-bundle

```

Usage
-----

[](#usage)

Where it is necessary to create a form, for example a controller or a service, you must inject the FormGenerator object provided by the bundle.

```
class HomeController extends AbstractController
{
    /** @required */
    public FormGenerator $formGenerator;

    public function __invoke(Request $request): Response
    {
        $formConfigArray = []; // configuration as associative array

        // Gets a FormInterface object with the configured form
        $form = $this->formGenerator->createForm($formConfigArray);

        $form->handleRequest($request);

        if($form->isSubmitted() && $form->isValid()){
            $formData = $form->getData();

            // process your form
        }
    }
```

The FormGenerator service provides the following methods:

1. **FormGenerator::createForm(array $formConfig, array $formOptions = \[\], $data = null, string $baseFormTypeClass = null, string $groupName = null):** Creates a form from an associative array
2. **FormGenerator::createFormFromJson(string $formConfigJson, array $formOptions = \[\], $data = null, string $baseFormTypeClass = null, string $groupName = null):** Creates a form from a json string
3. **FormGenerator::createFormFromYaml(string $formConfigYaml, array $formOptions = \[\], $data = null, string $baseFormTypeClass = null, string $groupName = null):** Creates a form from a yaml string

### Method arguments

[](#method-arguments)

1. **array $formConfig:** form configuration
2. **array $formOptions = \[\]:** custom form options
3. **$data = null:** form data
4. **string $baseFormTypeClass = null:** Form class (FQN) that will be used as the base to add the other fields. If not passed, they are added to an empty form.
5. **string $groupName = null:** name that will be used to group the fields created by the $formConfig argument as an embeded form

Development
-----------

[](#development)

### Install dependencies

[](#install-dependencies)

```
composer install

```

### Testing

[](#testing)

```
vendor/bin/phpunit

```

### Code Review

[](#code-review)

- phpstan levels:

```
vendor/bin/phpstan analyse src tests --level 5

```

- phpmd:

```
vendor/bin/phpmd ./ text .phpmd-ruleset.xml --exclude var,vendor

```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance89

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~118 days

Recently: every ~250 days

Total

14

Last Release

55d ago

PHP version history (2 changes)1.0.0PHP ^7.4.0|&gt;=8.0

1.0.3PHP ^7.4|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/238768?v=4)[Juan Ardissone](/maintainers/micayael)[@micayael](https://github.com/micayael)

---

Top Contributors

[![micayael](https://avatars.githubusercontent.com/u/238768?v=4)](https://github.com/micayael "micayael (47 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/micayael-form-generator-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/micayael-form-generator-bundle/health.svg)](https://phpackages.com/packages/micayael-form-generator-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[a2lix/auto-form-bundle

Automate form building

873.8M11](/packages/a2lix-auto-form-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
