infinite-networks/form-bundle
Infinite Networks FormBundle is a Symfony bundle that adds reusable form types and helpers on top of Symfony Forms, reducing boilerplate when building, rendering, and handling forms. It integrates cleanly into existing Symfony applications and streamlines common form workflows.
composer require infinite-networks/form-bundle, historically ~2.0 for Symfony 2.8/3.x; last tagged release was 2017-05-12) and register InfiniteNetworks\FormBundle\InfiniteFormBundle in AppKernel.php / config/bundles.php.DependencyInjection/Configuration.php (the infinite_form tree) and Resources/config/*.xml/*.yml to see exactly which form types and FormTypeExtensions are pre-registered. Most day-to-day value comes from extensions, not from the types themselves — extensions apply silently to every matching form field.{% form_theme form 'InfiniteFormBundle::layout.html.twig' %}
(Symfony 4+ path would be @InfiniteForm/layout.html.twig, but see Gotchas.)Infinite\FormBundle\Form\Type\ImageType into an entity form with a thumbnail + delete/reset UI:
->add('photo', ImageType::class, [
'image_path' => 'getWebPath', // or a property
'image_size' => ['width' => 200],
'allow_delete' => true,
])
Second: enable a WYSIWYG on an existing TextareaType via the wysiwyg option, or add placeholder/help/autocomplete options to text fields without touching templates.PlaceholderExtension, AutocompleteExtension, LengthExtension, HelpExtension, WysiwygExtension, Select2Extension, ChosenExtension, SortableExtension, TabExtension, and RecaptchaExtension attach to their target types. Set the option ('placeholder' => '...', 'help' => '...', 'wysiwyg' => 'ckeditor', 'autocomplete' => false, 'length' => ['min' => 5]) on the field — no custom widget needed.TextareaType and set 'wysiwyg' => 'tinymce' or 'ckeditor'; toggle the default in infinite_form config if most textareas should be rich editors. Prefer a named toolbar option per field when forms mix rich and plain text.ImageType (single image with preview, allow_delete, show_reset_button) and FileType (multi-file / dropzone) instead of hand-rolled FileType + Twig. Provide a path via a getter/setter on the entity (image_path, image_setter-style options) so the widget can render previews and honor delete checkboxes on submit. Combine with Symfony's standard delete/mapped => false mapping if you want a clean service class rather than an entity.AutoCompleteType with a JSON route ('route' => 'app_user_search', 'entity' => User::class, 'property' => 'name', plus a 'search' callable/repository method for custom queries). Return [{id, text}, ...]; the field stores the selected id as a normal EntityType-style value, so validation and Doctrine mapping behave normally.CollectionType with 'sortable' => true; the JS records data-sortable on each row. In the controller, reorder the submitted collection (by _sort / data-sortable index) before persisting, and use by_reference => false plus a setter so the reordered array is assigned back to the entity.TabExtension lets you group fields via the tab option and render with the bundle's tab helper/theme. Prefer this over hand-writing tab markup when you already use the bundle's theme, so field errors surface in the correct tab.RecaptchaType and configure site/secret keys under infinite_form (component flags also control whether the reCAPTCHA <script> is emitted by the layout template). Validation runs via the bundle's constraint — disable the key or use a fake in functional tests.getName() on types, form.type_extension tag format, and deprecated DependencyInjection APIs all need patching or a fork.'placeholder' => false/null, 'autocomplete' => false) or restrict the extension by config; use bin/console debug:form AppBundle\Form\FooType (Symfony 3+) to see which extensions and options are actually applied.components config flags only influence whether the shipped layout.html.twig emits <script>/<link> tags for jQuery, jQuery UI, Select2, Chosen, Bootstrap, datetimepicker, CKEditor, TinyMCE, Dropzone, Sortable, reCAPTCHA. You still must ship those vendor files (or point the tags at CDNs). With Webpack Encore/Vite, set the component flags off and include the assets yourself to avoid duplicate/conflicting jQuery.ImageType/FileType/tab/sortable widgets expect the bundle's Twig theme; using the default Symfony theme produces broken markup or missing handles. If you only need one widget, extend the bundle theme in a local theme instead of pulling in the whole layout.data-sortable order is only meaningful if your submit handler reads it — the bundle doesn't reorder entities for you. Also guard against by_reference (Doctrine may keep the original collection order) and add a missing-_sort fallback for clients with JS disabled.allow_delete returns a checkbox in the request, not a nulled field; make sure the entity setter/nullable mapping handles the delete case, and clear the physical file in a preFlush/postRemove listener — the bundle won't.getExtendedType() (e.g., LengthExtension targets TextType, not TextareaType) and check that infinite_form config from your app overrides the bundle defaults (bundle defaults may silently win if the extension key isn't set).FormTypeExtensionInterface services tagged form.type_extension for anything custom; the bundle's own extensions are good reference implementations, and you can subclass its types (e.g., ImageType) to change defaults.How can I help you explore Laravel packages today?