- Can SuluFormBundle be used in a Laravel project without Sulu CMS?
- No, SuluFormBundle is tightly coupled with Sulu CMS (v2.0+) and relies on its admin UI, content management, and workflow systems. Laravel integration would require significant abstraction layers or a microservice approach to decouple the form logic from Sulu’s dependencies.
- What Laravel alternatives exist for dynamic forms with admin UI?
- For Laravel, consider Filament Forms, Nova Forms, or Laravel Collective Forms for dynamic form creation. These packages are Laravel-native and avoid Symfony’s dependency stack. If you need a no-code admin UI, Filament or Nova might be better fits.
- How do I handle Symfony’s Form Component in Laravel’s validation system?
- SuluFormBundle uses Symfony’s Form Component, which conflicts with Laravel’s Validator. You’d need to create a wrapper service provider to bridge Symfony’s FormType and constraints to Laravel’s validation rules or replace Symfony’s validation with Laravel’s native Validator in a custom layer.
- Does SuluFormBundle support Laravel’s Blade templating instead of Twig?
- No, the bundle relies on Twig for theming. To use Blade, you’d need to rewrite the templating layer or use Inertia.js to render forms in Laravel’s frontend while keeping the backend logic in SuluFormBundle. This adds complexity and may require custom middleware.
- What’s the best way to integrate SuluFormBundle’s routing into Laravel?
- SuluFormBundle uses Symfony’s RESTful routing (e.g., `/form/{id}`). In Laravel, you’d need to map these routes to Laravel’s API resources or controller methods. Use a service provider to override or proxy the routing logic, or expose the forms via a microservice API if tight coupling is unavoidable.
- How does SuluFormBundle handle CSRF protection in Laravel?
- The bundle uses Symfony’s CSRF protection, which conflicts with Laravel’s built-in CSRF middleware. You’ll need to disable Symfony’s CSRF checks and rely solely on Laravel’s `@csrf` directive or implement custom middleware to handle token validation for form submissions.
- Can I migrate SuluFormBundle’s PHPCR database schema to Laravel’s Eloquent?
- PHPCR (used by Sulu) is incompatible with Laravel’s relational database. You’d need to write migration scripts to convert form, field, and submission data into Eloquent models. This requires careful mapping of Sulu’s content structure to Laravel’s schema and may break dynamic form features.
- Is SuluFormBundle actively maintained for Laravel compatibility?
- No, SuluFormBundle is primarily maintained for Sulu CMS and Symfony. While it supports Symfony 7, Laravel integration is not a focus. You’d need to fork the package and adapt it yourself, which could lead to merge conflicts during Sulu’s updates.
- How do I configure email notifications for forms in Laravel?
- SuluFormBundle allows content managers to configure email notifications via the admin UI. In Laravel, you’d need to override the email service or event listeners to use Laravel’s Mail system. This involves extending the bundle’s event system or replacing its SwiftMailer dependency with Laravel’s Mailer.
- What’s the performance impact of using SuluFormBundle in Laravel?
- Dynamic forms in Sulu’s admin UI may introduce overhead due to drag-and-drop field management and PHPCR queries. In Laravel, this could slow down frontend operations if not optimized. For production, consider caching form definitions or using a hybrid storage layer (e.g., database + filesystem) to reduce PHPCR dependency.