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

ActiveLibrary[Templating &amp; Views](/categories/templating)

linio/dynamic-form-bundle
=========================

Generates symfony forms based on YAML configuration files

3.0.0(3y ago)1928.9k↓48.4%11[3 issues](https://github.com/LinioIT/dynamic-form-bundle/issues)[1 PRs](https://github.com/LinioIT/dynamic-form-bundle/pulls)BSD-3-ClausePHPPHP ^8.0

Since May 21Pushed 3y ago55 watchersCompare

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

READMEChangelog (10)Dependencies (7)Versions (25)Used By (0)

Dynamic Form Bundle
===================

[](#dynamic-form-bundle)

[![Latest Stable Version](https://camo.githubusercontent.com/e451f421a929c44c1a22c8b4f3d8c8d0b1c1e0d80a16e061c65dd924daf87fd0/68747470733a2f2f706f7365722e707567782e6f72672f6c696e696f2f64796e616d69632d666f726d2d62756e646c652f762f737461626c652e737667)](https://packagist.org/packages/linio/dynamic-form-bundle)[![License](https://camo.githubusercontent.com/1e89cb640df44b84259cc52771303c4fee8f97e644d3ae8340c24f6f2c56681b/68747470733a2f2f706f7365722e707567782e6f72672f6c696e696f2f64796e616d69632d666f726d2d62756e646c652f6c6963656e73652e737667)](https://packagist.org/packages/linio/dynamic-form-bundle)[![Build Status](https://camo.githubusercontent.com/1d87ec94e4fa6be2bb50e32815b8cd40242516d570c9432ccab533bd43341055/68747470733a2f2f7472617669732d63692e6f72672f4c696e696f49542f64796e616d69632d666f726d2d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/LinioIT/dynamic-form-bundle)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/523f8488a708d77bb3da4a8db0be338109ffb2d1a7be98888b80cf14e642bcba/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4c696e696f49542f64796e616d69632d666f726d2d62756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/LinioIT/dynamic-form-bundle/?branch=master)[![Backend Coverage](.github/badges/coverage.svg)](.github/badges/coverage.svg)

> Generates symfony forms based on YAML configuration files

Getting Started
---------------

[](#getting-started)

This plugin supports Symfony `^2.8|^3.0|^4.0|^5.0`. Even tough we encorage you to use the latest version because of the Symfony maintained branches itself.

The recommended way to install Linio Dynamic Form Bundle is [through composer](http://getcomposer.org).

```
{
    "require": {
        "linio/dynamic-form-bundle": "~2.0"
    }
}
```

Tests
-----

[](#tests)

To run the test suite, you need install the dependencies via composer, then run PHPUnit.

```
$ composer install
$ vendor/bin/phpunit

```

Usage
-----

[](#usage)

Add the bundle on `registerBundles()` at `AppKernel.php`

```
new Linio\DynamicFormBundle\DynamicFormBundle();
```

The service `dynamic_form.factory` will be available.

Create your form on the Configuration File. The YAML structure for the Form should follow the next structure:

```
+---dynamic_form
|   \--- Form Name
|       \---Field Name
|           \---Field Options
|           \---Field Transformer
|           \---Field Validators

```

The method `createform()` takes the form configuration named `new_user` from `app/config/config.yml`.

```
use Linio\DynamicFormBundle\DynamicFormAware;

class TestController
{
	use DynamicFormAware;

	public function testAction()
	{
		$form = $this->getDynamicFormFactory()->createForm('new_user');
		return $this->render(
		  'WebBundle:Default:dynamicForms.html.twig',
		  ['form' => $form->createView(),]
		);
	}
}
```

The method `getJsonConfiguration()` takes the configuration from `app/config/config.yml`. and returns a JSON with the Form Configuration.

### Example

[](#example)

Here's an example of a form named `new_user` with a single field called `first_name`:

```
dynamic_form:
    new_user:
        first_name:
            enabled: true
            type: text
            options:
                type: password
                required: true
            transformers:
            validators:
```

### Options

[](#options)

Field options are the same as symfony, refer to the documentation

#### Birthday Type

[](#birthday-type)

Supports `Symfony >= 4.4`.

In addition to the own options that the field brings by default ([see documentation](https://symfony.com/doc/current/reference/forms/types/birthday.html)), we added 3 new attributes to make its behavior more flexible.

##### minAgeAllowed and maxAgeAllowed:

[](#minageallowed-and-maxageallowed)

These options work together and it is an improvement to the `years` option because it is too strict to only receive an array with the allowed years (and that in our case we should leave static in our Yaml file). With them we can determine (taking the current date) the minimum and maximum number of ages to generate the years that will be displayed in the form. These options only accept whole numbers greater than or equal to zero.

For example, if we want to have a field of type `birthday` but we only want children who have between **5** and **10** years of life to be registered, we would have something like the following:

```
dynamic_form:
    new_user:
        birthday:
            enabled: true
            type: birthday
            options:
                minAgeAllowed: 5
                maxAgeAllowed: 10
```

The above would generate this array of `years` =&gt; `[2016, 2015, 2014, 2013, 2012, 2011]` taking into account `2021` as the current year.

##### Order:

[](#order)

This option is used together with `minAgeAllowed` and `maxAgeAllowed` and is for the cases where we want to show our drop-down list of years in one order or another. The accepted values are **`asc`** and **`desc`**, the latter by default.

### Transformers

[](#transformers)

When using transformers write both the class where it is defined and the calls you need.

```
dynamic_form:
    new_user:
        birthday:
            enabled: true
            type: text
            transformer:
              class: 'Linio\Frontend\CustomerBundle\Form\DataTransformer\BirthdayTransformer'
              calls:
                  - [setUserFormat, ['d/m/Y']]
                  - [setInputFormat, ['Y-m-d']]
```

### Validators

[](#validators)

When using validators call each validator constraint and its parameters like shown down below.

```
dynamic_form:
    new_user:
        first_name:
            enabled: true
            type: text
            validation:
              'Symfony\Component\Validator\Constraints\True':
                  message: 'The token is invalid.'
              'Symfony\Component\Validator\Constraints\Length':
                  min: 2
                  max: 50
```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~173 days

Recently: every ~526 days

Total

17

Last Release

1243d ago

Major Versions

1.2.1 → 2.0.02017-03-16

2.3.0 → 3.0.02022-12-22

PHP version history (5 changes)1.0.0PHP ~5.4

1.0.6PHP &gt;=5.4

2.0.0PHP &gt;=7.1

2.3.0PHP ^7.4

3.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f9ba9a1e115b27dbff7b98800fad30327f99bef227202e72fa896b1780440692?d=identicon)[linio](/maintainers/linio)

---

Top Contributors

[![IsraelLinioMx](https://avatars.githubusercontent.com/u/11860414?v=4)](https://github.com/IsraelLinioMx "IsraelLinioMx (65 commits)")[![csanjuanc](https://avatars.githubusercontent.com/u/63084490?v=4)](https://github.com/csanjuanc "csanjuanc (52 commits)")[![tavofuentes](https://avatars.githubusercontent.com/u/7707696?v=4)](https://github.com/tavofuentes "tavofuentes (16 commits)")[![fernandocarletti](https://avatars.githubusercontent.com/u/416930?v=4)](https://github.com/fernandocarletti "fernandocarletti (15 commits)")[![klaussilveira](https://avatars.githubusercontent.com/u/467729?v=4)](https://github.com/klaussilveira "klaussilveira (9 commits)")[![damian-af](https://avatars.githubusercontent.com/u/9433699?v=4)](https://github.com/damian-af "damian-af (7 commits)")[![bpanatta](https://avatars.githubusercontent.com/u/4388638?v=4)](https://github.com/bpanatta "bpanatta (6 commits)")[![tamara-dietz](https://avatars.githubusercontent.com/u/29258573?v=4)](https://github.com/tamara-dietz "tamara-dietz (4 commits)")[![julioMZ](https://avatars.githubusercontent.com/u/8458669?v=4)](https://github.com/julioMZ "julioMZ (3 commits)")[![Rocko10](https://avatars.githubusercontent.com/u/4745682?v=4)](https://github.com/Rocko10 "Rocko10 (3 commits)")[![HellPat](https://avatars.githubusercontent.com/u/1016798?v=4)](https://github.com/HellPat "HellPat (1 commits)")[![felipegirotti](https://avatars.githubusercontent.com/u/1295097?v=4)](https://github.com/felipegirotti "felipegirotti (1 commits)")[![aramonc](https://avatars.githubusercontent.com/u/2242224?v=4)](https://github.com/aramonc "aramonc (1 commits)")

---

Tags

symfony-formssymfonySymfony2Formsdynamic

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/linio-dynamic-form-bundle/health.svg)

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

###  Alternatives

[qossmic/rich-model-forms-bundle

Provides additional data mapper options that ease the use of the Symfony Form component with rich models.

218278.7k](/packages/qossmic-rich-model-forms-bundle)[a2lix/auto-form-bundle

Automate form building

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

Symfony Mustache.php Bundle

1886.1k](/packages/bobthecow-mustache-bundle)[boekkooi/jquery-validation-bundle

Jquery form validation bundle for symfony 2

2773.9k1](/packages/boekkooi-jquery-validation-bundle)

PHPackages © 2026

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