idci / extra-form-bundle
Symfony bundle that expand existing FormType feature to allow a dynamic form generation
Installs: 65 251
Dependents: 1
Suggesters: 1
Security: 0
Stars: 5
Watchers: 12
Forks: 1
Open Issues: 1
Type:symfony-bundle
Requires
- php: ^7.2|^8.0
- friendsofsymfony/rest-bundle: >=2.5
- google/recaptcha: ^1.1
- gregwar/captcha-bundle: ~2.0
- jms/serializer-bundle: >=1.1
- symfony/dependency-injection: ^4.4|^5.3|^6.0
- symfony/event-dispatcher: ^4.4|^5.3|^6.0
- symfony/form: ^4.4|^5.3|^6.0
- symfony/http-foundation: ^4.4|^5.3|^6.0
- symfony/http-kernel: ^4.4|^5.3|^6.0
- symfony/options-resolver: ^4.4|^5.3|^6.0
- symfony/security-bundle: ^4.4|^5.3|^6.0
- symfony/translation: ^4.4|^5.3|^6.0
- symfony/validator: ^4.4|^5.3|^6.0
Requires (Dev)
- phpunit/phpunit: ~5.7
- symfony/framework-bundle: ^4.4|^5.3|^6.0
- symfony/security-bundle: ^4.4|^5.3|^6.0
- symfony/twig-bundle: ^4.4|^5.3|^6.0
Suggests
- idci/step-bundle: Allow to use the extra form mechanism in a step workflow
- dev-master
- v6.0.0
- 4.0.x-dev
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- 3.0.x-dev
- v3.0.8
- v3.0.7
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- 2.0.x-dev
- v2.0.12
- v2.0.11
- v2.0.10
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- 1.3.x-dev
- v1.3.1
- v1.3.0
- 1.2.x-dev
- v1.2.0
- 1.1.x-dev
- v1.1.1
- v1.1.0
- 1.0.x-dev
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dependabot/composer/twig/twig-2.15.3
This package is auto-updated.
Last update: 2024-10-24 10:48:12 UTC
README
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'
Installation
Install this bundle using composer:
$ php composer require idci/extra-form-bundle:dev-master
Import the bundle configuration:
# app/config/config.yml imports: - { 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:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle(), ); }
Enable the serializer:
# app/config/config.yml fos_rest: param_fetcher_listener: true # if you want to add configured types service: serializer: jms_serializer.serializer
Import the routes:
# app/config/routing.yml extra_form: 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:
<?php // 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
Documentation
Going further
Tests
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