Symfony bundle that expand existing FormType feature to allow a dynamic form generation

Installs: 61 247

Dependents: 2

Suggesters: 1

Security: 0

Stars: 5

Watchers: 12

Forks: 1

Open Issues: 1


v4.0.4 2020-05-27 07:30 UTC


ExtraFormBundle is a Symfony bundle that expand existing FormType features to allow dynamic forms generation.

This bundle provide:

  • A builder to generate forms from a configuration array. This allow you to configure your forms in any format convertible in an array (yaml, json, etc) and dynamically generate your forms.
  • A set of extra types (iban, captcha..) ready to use.
  • An api that exposes all symfony form types as 'extra form types'
  • An api that exposes all symfony validation constraints as 'extra form constraints'

SensioLabsInsight Build


Install this bundle using composer:

$ php composer require idci/extra-form-bundle:dev-master

Import the bundle configuration:

# app/config/config.yml

    - { resource: '@IDCIExtraFormBundle/Resources/config/config.yml' }

That's it, you are ready to use the extra form builder.

Use the editor

If you need the api or the editor:

// app/AppKernel.php

public function registerBundles()
    $bundles = array(
        // ...
        new FOS\RestBundle\FOSRestBundle(),
        new JMS\SerializerBundle\JMSSerializerBundle(),

Enable the serializer:

# app/config/config.yml

    param_fetcher_listener: true # if you want to add configured types
        serializer: jms_serializer.serializer

Import the routes:

# app/config/routing.yml
    resource: "@IDCIExtraFormBundle/Controller/"
    type: annotation

Install the assets:

php bin/console assets:install --symlink

The editor requires bootstrap and jquery. If you don't use it already in your project, just add the following lines in your views.

{% block javascripts %}
    {{ parent() }}
    <script type="text/javascript" src="{{ asset('bundles/idciextraform/js/vendor/jquery-2.2.4.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('bundles/idciextraform/js/vendor/bootstrap.min.js') }}"></script>
{% endblock %}

{% block stylesheets %}
    {{ parent() }}
    <link rel="stylesheet" type="text/css" href="{{ asset('bundles/idciextraform/css/bootstrap.min.css') }}" />
    <link rel="stylesheet" type="text/css" href="{{ asset('bundles/idciextraform/css/bootstrap-theme.min.css') }}" />
{% endlbock %}

Use the configured types

You can register configured types via the editor. It allows you to access types with pre-configured fields.

Register doctrine bundle in your application kernel:

// app/AppKernel.php

public function registerBundles()
    $bundles = array(
        // ...
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),

Then update the doctrine schema. It will create a table to register the configured types in database.

doctrine:schema:update --force


Going further


We use docker and docker-compose to run the tests, along with a Makefile.

Install the bundle dev dependencies:

$ make composer-update

To execute unit tests:

$ make phpunit