Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Form Bundle Laravel Package

sbsedv/form-bundle

A Symfony bundle for working with forms, providing reusable form types, extensions, and helpers that reduce boilerplate and keep form configuration consistent across applications. Built to integrate smoothly with Symfony’s Form component and common form workflows.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install via Composer: composer require sbsedv/form-bundle.
  • Symfony: register the bundle in config/bundles.php (SBSEDV\FormBundle\FormBundle::class => ['all' => true]). Check the repo’s README.md and docs/ for bundle-specific configuration (if any).
  • Laravel: this is a Symfony bundle, not a Laravel package. You can still use the underlying Symfony Form component standalone, but you’ll need to manually wire the form factory and request handling. For most Laravel projects, native form packages or laravel-form-builder are a better fit.
  • First use case: create a form type extending Symfony\Component\Form\AbstractType, define fields in buildForm(), and use it in a controller to render and process a form.

Implementation Patterns

  • Reusable form types: encapsulate fields in dedicated AbstractType classes; inject dependencies via constructor and declare them as services.
  • Dynamic forms: use event listeners on FormEvents::PRE_SET_DATA and POST_SUBMIT to add/remove fields based on data or user input.
  • Controller workflow: $form = $this->createForm(MyType::class, $data); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { ... }.
  • Rendering: use Twig’s form_start, form_widget, form_end; customize appearance with form themes. In Laravel, you’ll need a Twig bridge or manual HTML rendering.
  • Validation: attach constraints to your underlying data class or use constraints option on fields; handle errors via $form->getErrors().
  • Laravel integration tip: if you must use it in Laravel, bootstrap Symfony’s FormFactory with HttpFoundationRequestHandler, and pass the Laravel request converted to a Symfony request. Expect to handle CSRF tokens manually.

Gotchas and Tips

  • Symfony 8 support: v1.10.0 only adds compatibility with Symfony 8; no breaking changes. Ensure your Symfony version matches the constraint in composer.json—older Symfony versions (6/7) should use v1.9.x.
  • Not a Laravel package: the bundle is Symfony-specific. In Laravel, you lose auto-configuration, Twig integration, and native CSRF handling. Consider whether a Laravel-native form package is more appropriate.
  • CSRF protection: enabled by default in Symfony; in Laravel you must explicitly pass the token and configure the form factory’s CSRF provider.
  • Debugging: use dump($form->getErrors(true)) to inspect validation errors; add dump() inside form event listeners to trace dynamic field changes.
  • Extension points: custom form types, form extensions (to add global options), data transformers, and event subscribers are the main ways to extend behaviour.
  • Config quirks: check the bundle’s configuration reference (if published) for default options; some features may depend on specific Symfony minor versions.
  • Version pinning: since the release only widens Symfony compatibility, review the composer.json constraints before upgrading—especially if you’re on Symfony 8.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings