Weave Code
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

sulu/form-bundle

SuluFormBundle adds dynamic form creation to Sulu Admin. Content managers build and arrange fields in a grid, configure email notifications, and power contact/sweepstake forms. Built on the Symfony Form Component with theming support.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Sulu CMS Integration: The bundle is tightly coupled with Sulu CMS (v2.0+), leveraging its admin UI, content management, and workflow systems. This makes it ideal for projects already using Sulu but introduces vendor lock-in if migrating away.
  • Symfony Form Component: Built on Symfony’s Form Component, ensuring compatibility with Symfony’s validation, theming, and data binding. This aligns well with Laravel’s Form Requests and Validation systems but requires abstraction layers for seamless adoption.
  • Dynamic Forms: Supports no-code form creation via Sulu’s admin panel, reducing backend development effort. However, this may limit custom validation logic or complex business rules without extensions.
  • Event-Driven: Integrates with Sulu’s ActivityBundle for event tracking (e.g., form submissions), useful for analytics but adds event listener complexity.

Integration Feasibility

  • Laravel Compatibility:
    • Low: Laravel’s service container, routing, and middleware differ significantly from Symfony. Key challenges:
      • Dependency Injection: SuluFormBundle relies on Symfony’s DI container (e.g., sulu_form.form_handler). Laravel’s IoC would require adapters or facades.
      • Routing: Uses Symfony’s restful routing (e.g., /form/{id}). Laravel’s resource routing or custom routes would need mapping.
      • CSRF Protection: Deprecated DisabledCsrfTokenManager conflicts with Laravel’s built-in CSRF. Custom middleware would be needed.
    • Workarounds:
      • Wrapper Layer: Create a Laravel service provider to bridge Symfony services (e.g., FormHandler) to Laravel’s container.
      • API Proxy: Expose SuluFormBundle as a microservice (via API) if tight coupling is unavoidable.
  • Database Schema:
    • Uses Doctrine ORM (e.g., form, form_field, form_submission tables). Laravel’s Eloquent or Query Builder would need migration scripts to adapt schemas.
    • PHPCR (Jackalope): Sulu uses PHPCR for content storage. Laravel’s filesystem or database would require a data mapper or hybrid storage layer.

Technical Risk

  • High Integration Risk:
    • Symfony-Specific Features: Twig templating, Symfony’s FormType, and EventDispatcher require rewrites or polyfills.
    • CSRF/Session Handling: Deprecated ESI-based CSRF tokens (Symfony 5.4+) clash with Laravel’s session management.
    • Media Handling: Relies on Sulu’s MediaManagerInterface. Laravel’s Spatie Media Library or VentureCraft would need integration.
  • Performance Risk:
    • Dynamic Forms: Heavy admin UI operations (e.g., drag-and-drop fields) may bloat Laravel’s frontend if not optimized.
    • Database Queries: PHPCR queries could degrade performance in Laravel’s relational DB environment.
  • Maintenance Risk:
    • Forking Required: Custom adaptations may diverge from upstream SuluFormBundle, increasing merge conflicts.
    • Deprecations: Active development (e.g., Symfony 7 support) may introduce breaking changes requiring constant updates.

Key Questions

  1. Why Laravel?
    • Is Sulu’s admin UI a hard requirement, or can forms be decoupled (e.g., via API)?
    • Are there alternative Laravel packages (e.g., Laravel Collective Forms) that meet needs?
  2. Scope of Integration:
    • Should this replace all Laravel forms, or only specific use cases (e.g., contact forms)?
    • Is Sulu’s admin panel necessary, or can forms be frontend-only?
  3. Team Expertise:
    • Does the team have Symfony/Laravel hybrid experience to manage integration complexity?
    • Is there budget for custom development to bridge gaps?
  4. Long-Term Viability:
    • Will the project remain Sulu-dependent, or is extraction a future goal?
    • Are there Laravel-native alternatives (e.g., Filament Forms) with lower risk?

Integration Approach

Stack Fit

  • Laravel Core:
    • Forms: Replace Symfony FormType with Laravel’s Form Requests or Livewire/Alpine.js for dynamic frontend forms.
    • Validation: Use Laravel’s Validator instead of Symfony’s constraints.
    • Routing: Map Sulu’s REST routes to Laravel’s API resources or controller methods.
    • Templating: Replace Twig with Blade or Inertia.js for frontend rendering.
  • Database:
    • Option 1: Migrate PHPCR data to Eloquent models (high effort).
    • Option 2: Use Doctrine DBAL in Laravel to interact with Sulu’s existing tables.
    • Option 3: Hybrid approach: Store form definitions in Laravel DB but use Sulu’s admin for editing (via API).
  • Authentication/Authorization:
    • Sulu’s RBAC would need mapping to Laravel’s Gate/Policy system or Passport/Sanctum.
  • Media Handling:
    • Replace MediaManagerInterface with Spatie Media Library or VentureCraft Revise.

Migration Path

Phase Action Tools/Dependencies Risk
Assessment Audit current form usage; identify Sulu-specific dependencies. Postman (API testing), Laravel IDE Helper Low
Abstraction Create adapter layer for Symfony services (e.g., SuluFormHandler). Laravel Service Providers, Symfony Polyfills Medium
Frontend Replace Twig templates with Blade/Inertia; migrate JS (e.g., Dropzone). Alpine.js, Laravel Mix/Vite Medium
Backend Rewrite form submission logic to use Laravel’s Form Requests. Laravel Validation, API Resources High (business logic)
Database Decide on schema strategy (migrate, hybrid, or proxy). Doctrine DBAL, Eloquent High (data integrity)
Admin UI Option 1: Keep Sulu admin (API proxy). Option 2: Build Laravel admin. Filament, Nova, or custom Blade admin High (UI complexity)
Testing Write Pest/Feature tests for form submission, validation, and storage. Laravel Testing, Mockery Medium
Deployment Containerize Sulu + Laravel (Docker) or split into microservices. Docker, Kubernetes Medium

Compatibility

  • Symfony 6/7: Laravel’s PSR-15 middleware and HTTP client can replace Symfony’s EventDispatcher and HttpClient.
  • PHP 8.4: No conflicts; Laravel 10+ supports PHP 8.4.
  • Sulu-Specific:
    • Workflows: Sulu’s workflow system (e.g., draft/publish) would need replication in Laravel (e.g., Laravel Workflow package).
    • Localization: Sulu’s shadow locales would require custom logic in Laravel’s localization middleware.

Sequencing

  1. Pilot Phase:
    • Integrate one form type (e.g., contact form) as a proof of concept.
    • Use API proxy to avoid full Sulu coupling.
  2. Core Integration:
    • Implement form submission handling in Laravel.
    • Replace Symfony FormType with Laravel equivalents.
  3. Admin Panel:
    • Decide between Sulu admin (API-driven) or Laravel admin (Filament/Nova).
  4. Advanced Features:
    • Add Sendinblue integration via Laravel’s Mailables.
    • Implement dynamic field validation using Laravel’s custom rules.

Operational Impact

Maintenance

  • Dependency Updates:
    • High Frequency: SuluFormBundle and Sulu CMS release often (e.g., Symfony 7 support in 3.0). Laravel’s slower release cycle may cause version skew.
    • Mitigation: Use Composer’s platform-check or GitHub Actions to auto-test updates.
  • Custom Code:
    • Adapter Layer: Requires ongoing maintenance to sync with SuluFormBundle changes.
    • Forking: If heavily modified, merge conflicts with upstream will increase.
  • Documentation:
    • Gap: SuluFormBundle docs assume Symfony/S
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky