- How do I install derafu/form in a Laravel project?
- Run `composer require derafu/form` to install the package. The package includes a service provider that auto-registers Blade directives and form helpers, so no additional configuration is needed unless you want to publish config files with `php artisan vendor:publish --tag=derafu-form-config`.
- Does derafu/form work with Laravel 10 and newer?
- The package is designed for Laravel 9+ and should work with Laravel 10, but check the [documentation](https://www.derafu.dev/docs/ui/form) for confirmed compatibility. Since it relies on Laravel’s core features (Blade, validation, and service container), updates to Laravel’s APIs may require minor adjustments.
- Can I use derafu/form alongside Livewire or Inertia.js?
- Yes, derafu/form is Blade-centric and should integrate with Livewire or Inertia.js, but you’ll need to manually handle dynamic form state (e.g., via Alpine.js or Livewire’s reactivity). The package doesn’t replace client-side frameworks but provides server-side form definitions and rendering for static or semi-dynamic forms.
- How does derafu/form handle form validation errors and old input?
- The package leverages Laravel’s built-in validation and session-based error handling. Old input is preserved automatically, and validation errors are flashed to the session, just like Laravel’s default behavior. You can customize this via configuration if needed, but it doesn’t override Laravel’s core mechanisms.
- Is there a way to customize form rendering or validation logic?
- Yes, derafu/form provides extension points for both rendering and validation. You can override Blade directives, create custom field types, or extend validation rules by binding your own logic to the package’s events or service container bindings. Check the documentation for specific hooks.
- Does derafu/form support file uploads or multi-part forms?
- Yes, the package integrates with Laravel’s `Request` handling for file uploads. You can define file fields declaratively, and it will work with Laravel’s `File` facade or `hasFile()` validation methods. However, custom logic for handling uploads (e.g., storage paths) may still require manual implementation.
- How does derafu/form handle CSRF protection and XSS vulnerabilities?
- CSRF protection is handled automatically via Laravel’s built-in middleware, and user inputs are escaped when rendered through Blade. The package doesn’t introduce additional security risks beyond Laravel’s defaults. For extra safety, ensure you’re using Blade’s `@csrf` directive or Laravel’s `Form::macro` for CSRF tokens.
- Can I migrate an existing Laravel Collective Form setup to derafu/form?
- Yes, the migration should be straightforward since both packages work with Blade. Replace `Form::macro` calls with derafu/form’s declarative syntax, and update validation logic to use the package’s helpers. However, test thoroughly, as some Collective-specific macros may not have direct equivalents.
- Are there performance concerns with derafu/form, like slower Blade compilation?
- The package introduces minimal overhead. Blade directives are compiled once, and form definitions are cached like any other Blade component. For large forms, ensure you’re not redefining fields unnecessarily in loops or dynamic contexts, as this could impact compilation time.
- What’s the maintenance status of derafu/form, and is it actively developed?
- As of now, derafu/form appears to be a well-structured but niche package with limited community adoption. Check the [GitHub repository](https://github.com/derafu/form) and [documentation](https://www.derafu.dev/docs/ui/form) for recent commits or roadmap updates. If maintenance is a concern, consider alternatives like Laravel Nova or Livewire for more actively maintained solutions.