PHPackages                             talan/dynamic-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. talan/dynamic-form

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

talan/dynamic-form
==================

The Dynamic Form Bundle

8194PHP

Since Oct 7Pushed 10y ago5 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

TalanDynamicFormBundle
======================

[](#talandynamicformbundle)

[![Build Status](https://camo.githubusercontent.com/1b06b60ea4172feb058e0b1256b931d9eb2ae44390274bd3f98226fb3a227dd5/68747470733a2f2f7472617669732d63692e6f72672f54616c616e54756e697369652f44796e616d6963466f726d42756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/NightFox7/DynamicFormBundle)[![Code Climate](https://camo.githubusercontent.com/76cc9add58beaa5083c38c881cdec0a3df8b12ee75efeb270bb8dad7315155da/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4e69676874466f78372f44796e616d6963466f726d42756e646c652f6261646765732f6770612e737667)](https://codeclimate.com/github/NightFox7/DynamicFormBundle)

A Dynamic Form Builder for Symfony2 using [kelp404/angular-form-builder](https://github.com/kelp404/angular-form-builder).

\##Frameworks

1. [AngularJS 1.2](http://angularjs.org/)
2. [jQuery](http://jquery.com/)
3. [Bootstrap 3](http://getbootstrap.com/)
4. [Angular-validator](https://github.com/kelp404/angular-validator)
5. [jQuery Datatable](https://www.datatables.net)
6. [Angular Datatable](http://l-lin.github.io/angular-datatables)
7. [Angular Form Builder](https://github.com/kelp404/angular-form-builder)

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

[](#installation)

### Get the bundle

[](#get-the-bundle)

Add the following lines in your composer.json:

```
// composer.json
{
    "require": {
        "talan/dynamic-form" : "dev-master"
    }
}
```

### Initialize the bundle

[](#initialize-the-bundle)

To start using the bundle, register the bundle in your application's kernel class:

```
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Talan\Bundle\DynamicFormBundle\TalanDynamicFormBundle(),
    );
)
```

### Create the bundle's tables

[](#create-the-bundles-tables)

Execute the following commands under the project's main folder:

```
$ php app/console doctrine:schema:update --force
$ php app/console doctrine:fixture:load --fixtures=vendor/talan/dynamic-form/Talan/Bundle/DynamicFormBundle/DataFixtures/ORM --append

```

This will create 8 tables prefixed with "*talan\_*" in your database schema:

- **talan\_form**: Stores the forms created by the Back-Office.
- **talan\_field\_type**: Contains the different field types supported by the bundle.
- **talan\_field**: Stores the fields associated to every created form.
- **talan\_value**: Stores the common information related to the values inserted by the form users
- **talan\_string\_value**: Stores the values of the input text fields.
- **talan\_text\_value**: Stores the values of the textarea fields.
- **talan\_integer\_value**: Stores the values of the select and radio fields.
- **talan\_array\_value**: Stores the values of the checkbox fields.

### Import TalanDynamicFormBundle routing files

[](#import-talandynamicformbundle-routing-files)

TalanDynamicFormBundle comes with default controllers and views that uses the developed services to offer the Back and Front Office functionnalities. To activate the required pages you simply need to import the bundle's routing file:

```
# app/config/routing.yml
talan_dynamic_form:
    resource: "@TalanDynamicFormBundle/Resources/config/routing.yml"
    prefix:   /
```

You may of course add a prefix of your choice.

If you like to add specific behaviors to the controllers or change the displayed pages, you simply extends this bundle and make your own implementations of the controllers or the twigs of this bundle.

#### Override the default layout.html.twig

[](#override-the-default-layouthtmltwig)

The layout file of this bundle imports the javascript dependencies from various links. Therefore, we highly recommande that you download the required frameworks mentioned above, override the layout file and use the assetics to include the downloaded frameworks.

The easiest way to override a bundle's template is to simply place a new one in your app/Resources folder. To override the layout template located at Resources/views/layout.html.twig in the TalanDynamicFormBundle directory, you would place your new layout template at app/Resources/TalanDynamicFormBundle/views/layout.html.twig

The following Twig template file is an example of a layout file that might be used to override the one provided by the bundle.

```
{% extends 'AcmeDemoBundle::layout.html.twig' %}

{% block title %}Acme Demo Application{% endblock %}

{% block content %}
    {% block talan_dynamic_form_content %}{% endblock %}
{% endblock %}
```

The main thing to note in this template is the block named talan\_dynamic\_form\_content. This is the block where the content from each of the different bundle's actions will be displayed, so you must make sure to include this block in the layout file you will use to override the default one.

### Add Value Owner Providers

[](#add-value-owner-providers)

When a user of the application submit the values of a certain form created by this bundle, these values should be attached somehow to that specific user. However, this link between the submitted values and the user depends on the nature of the application. Therefore, it should be up to the developer and the Back-office to specify the way to attach these elements.

This bundle provides the above feature by introducing the *ValueOwnerProviderInterface* and abstract implementation *AbstractOwnerProvider*.

The *ValueOwnerProviderInterface* requires the implementation of 3 methods which are *getValueOwner()* , *getOwnerListTemplate()* and *getValueOwnerList($formId)*. And we added the *AbstractOwnerProvider* Class to provide a default owner template.

So by implementing th interface or extending the abstract class then injecting the service with the required tag, the developer should be able to specify how the submitted values and the user could be linked to each other.

TalanDynamicFormBundle comes with 2 pre-implemented classes of the *ValueOwnerProviderInterface*. They are *AbstractUserValueProvider* and *SessionValueProvider* which is declared as a service.

Here is the *ServiceValueProvider* Class:

```
class SessionValueProvider extends AbstractValueOwnerProvider
{
    protected $session;
    protected $em;

    public function __construct(EntityManager $em,Session $session)
    {
        $this->session = $session;
        $this->em = $em;
    }

    /**
     * (non-PHPdoc)
     * @see \Talan\Bundle\DynamicFormBundle\Service\ValueOwnerProviderInterface::getValueOwner()
     */
    public function getValueOwner()
    {
        return $this->session->getId();
    }
}
```

As you can see the only requiered method to implement is *getValueOwner()* and we injected the *session* variable in order to get the user's session ID.

To activate the session value provider, you need to add the configuration below to your services.yml.

```
# src/Demo/Bundle/DemoBundle/Resources/config/services.yml
parameters:
    talan_dynamic_form.session_provider.class: Talan\Bundle\DynamicFormBundle\Service\Impl\SessionValueProvider

services:
    talan_dynamic_form.session_value_provider:
        class: "%talan_dynamic_form.session_provider.class%"
        arguments: ["@doctrine.orm.entity_manager","@session"]
        tags:
            - {name: talan_dynamic_form.value_owner_provider, alias: "Session Provider"}
```

Note that we injected the *@doctrine.orm.entity\_manager* and *@security* as an argument of the *SessionValueProvider* and we tagged the service with **talan\_dynamic\_form.value\_owner\_provider** tag. Tagging this service is very important as it allows the bundle to recognize this class as a ValueOwnerProvider. As for the alias, it is the label that will be shown to the back-office to choose from when creating a Form.

Here is the *AbstractUserValueProvider* Class:

```
abstract class AbstractUserValueProvider extends AbstractValueOwnerProvider
{
	protected $security;
	protected $em;

	public function __construct(EntityManager $em,SecurityContext $security)
	{
		$this->security = $security;
		$this->em = $em;
	}

	/**
	 * (non-PHPdoc)
	 * @see \Talan\Bundle\DynamicFormBundle\Service\ValueOwnerProviderInterface::getValueOwner()
	 */
	public function getValueOwner()
	{
		if (!$this->security) {
			throw new \LogicException('The SecurityBundle is not registered in your application.');
		}

		if (null === $token = $this->security->getToken()) {
			return;
		}

		if (!is_object($user = $token->getUser())) {
			return;
		}

		return $user;
	}

}
```

This class is declared abstract so that each user can define its own implemtation of the two methods *getValueOwnerList()* and *getOwnerListTemplate()*. Here is a sample implementation:

```
class UserValueProvider extends AbstractUserValueProvider
{
	protected $security;
	protected $em;

	public function __construct(EntityManager $em, SecurityContext $security)
	{
		$this->security = $security;
		$this->em = $em;
	}

	public function getOwnerListTemplate()
	{
		return 'TalanUserBundle::connectedUser.html.twig';
	}

	public function getValueOwnerList($formId){
		return $this->em->getRepository('TalanUserBundle:User')->findUsersByForm($formId);
	}
}
```

And here is the correspondent owner list template *connectedUser.html.twig*:

```
{% extends 'TalanDynamicFormBundle:OwnerList:default.html.twig' %}
{% block talan_dynamic_form_owner_table %}

        {{ 'dynamicForm.owner.id' | trans }}
        {{ 'dynamicForm.owner.fullName' | trans }}
        {{ 'dynamicForm.owner.email' | trans }}
        {{ 'dynamicForm.owner.phone' | trans }}
        {{ 'dynamicForm.bo.actions' | trans }}

    {% for owner in ownerList %}

        {{ owner.id }}
        {{ owner.firstName }} {{ owner.lastName }}
        {{ owner.email }}
        {{ owner.phone }}

    {% endfor %}

{% endblock talan_dynamic_form_owner_table %}

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.9% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d2c3e0137b361a0b13e97919af73cf614673f5b834546e7dadec0adf449bdfc?d=identicon)[NightFox7](/maintainers/NightFox7)

---

Top Contributors

[![NightFox7](https://avatars.githubusercontent.com/u/5179294?v=4)](https://github.com/NightFox7 "NightFox7 (68 commits)")[![semiaLi](https://avatars.githubusercontent.com/u/7016226?v=4)](https://github.com/semiaLi "semiaLi (13 commits)")[![orthographic-pedant](https://avatars.githubusercontent.com/u/14522744?v=4)](https://github.com/orthographic-pedant "orthographic-pedant (1 commits)")

### Embed Badge

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

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

###  Alternatives

[greenter/greenter

Facturacion Electrónica SUNAT en Perú

31530.2k1](/packages/greenter-greenter)[opanegro/nova-custom-controller

Make custom controller in Laravel Nova

144.4k](/packages/opanegro-nova-custom-controller)

PHPackages © 2026

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