- How do I install sherlockode/advanced-form-bundle?
- Install it with Composer using composer require sherlockode/advanced-form-bundle, then register the bundle in your Symfony application (bundles.php in Symfony Flex, or AppKernel in older apps). Check the README for any required configuration or service setup. Because it extends Symfony's Form component, the standard Form dependencies should already be present in a typical Symfony project.
- Does AdvancedFormBundle work with Laravel?
- No. It is a Symfony bundle that integrates with Symfony's Form component and bundle registration, so it is not usable in a Laravel application without significant porting. Laravel developers should look at form request validation, Blade components, Livewire or Filament for dynamic form needs. This package is only a fit if your application is built on Symfony.
- How do I define a dynamic form in YAML with AdvancedFormBundle?
- You declare each form and its fields in YAML configuration, specifying field names, types and validation rules instead of writing a form class. At runtime the bundle reads that configuration and produces a standard Symfony FormInterface instance. The exact configuration keys are documented in the README, and you can adjust the YAML without touching PHP code.
- Can I create custom field types with AdvancedFormBundle?
- Yes. The bundle ships built-in field types with validation support and exposes an extensible type system so you can register your own inputs. That lets you map custom widgets or domain-specific inputs into generated forms. You implement the type following the bundle's type system and make it available to the configuration.
- Does AdvancedFormBundle support validation rules?
- The built-in field types come with validation support, and rules are part of the declarative form configuration. Because the result is a normal Symfony form, you can also use Symfony validator constraints and the standard form validation flow. For complex business rules, combine the configured rules with a constraint or a form event listener.
- How do I render a form generated by AdvancedFormBundle?
- You receive a standard Symfony FormInterface, so rendering works like any other Symfony form: create the form, pass it to your template, and use form_start, form_widget and form_end. Existing Twig form themes and layout conventions apply. Handle the request and validation in your controller exactly as you would with a hand-written form class.
- Which Symfony versions does sherlockode/advanced-form-bundle support?
- The bundle is registered like a classic Symfony bundle, so both Symfony Flex projects using bundles.php and older AppKernel-based apps can load it. The supported Symfony and PHP version ranges are declared in the package's composer.json, so check that file or the README before upgrading. Pin a version that matches your framework version and test the upgrade on a branch.
- How do I test forms built with AdvancedFormBundle?
- Since the bundle returns ordinary Symfony forms, you can test them with Symfony's Form component test utilities or a functional test that submits data through the controller. Assert on validation errors and on the resulting data object as usual. For configuration-driven forms, add a test that loads your YAML configuration so a broken field definition fails fast.
- Is AdvancedFormBundle production-ready and actively maintained?
- It is a small, focused bundle extending Symfony's Form component, so the main risks are maintenance cadence and compatibility with newer Symfony releases. Check the repository's commit history, open issues and latest tagged release before adopting it for a long-lived project. Because forms are configuration-driven, keep the YAML under version control and cover critical forms with tests.
- What are the alternatives to AdvancedFormBundle for dynamic forms?
- Alternatives include writing form classes by hand, which remains the most explicit option, building forms from database-driven metadata yourself, or using Symfony's Form component with dynamic form events and CollectionType. Some teams use admin or CMS bundles that include form configuration builders. AdvancedFormBundle makes sense when you specifically want YAML-declared fields and types with minimal PHP code.