maskow/livewire-combined-request
FormRequest class.$requiredParameters) mirrors Laravel’s route model binding, making it a natural fit for API-heavy applications where both HTTP and Livewire endpoints interact with the same business logic.CombinedFormRequest and replace existing FormRequest or manual Livewire validation. The migration path is straightforward for teams already using Laravel’s FormRequest or Livewire’s built-in validation.FormRequest classes without breaking changes. The optional camelCase-to-snake_case conversion can be toggled globally, minimizing disruption.parameter() method abstracts route model binding and Livewire property injection, but this abstraction might obscure debugging for developers unfamiliar with the pattern. Clear documentation and IDE support (e.g., PHPStorm hints) would mitigate this.notifyAuthorizationUsing) require explicit setup. Teams relying on default Livewire error handling might need additional configuration.FormRequest or Livewire’s validation patterns? If not, additional training or documentation may be required.FormRequest classes can now cover both HTTP and Livewire scenarios, but edge cases (e.g., missing parameters in Livewire) should be explicitly validated.FormRequest classes are shared across modules.CombinedFormRequest.$this->validate() calls with CombinedFormRequest::validateLivewire().FormRequest class continue to work.FormRequest classes to extend CombinedFormRequest.$this->team).FormRequest Classes: The package is a drop-in replacement for Laravel’s FormRequest. No changes are needed to HTTP routes or controllers.validate() or validateRule() can be migrated incrementally. The validateLivewire() method handles the conversion between Livewire properties and validation rules.FormRequest behavior (e.g., custom validation traits) may require testing.firstName → first_name).FormRequest classes work seamlessly with the new package.FormRequest class becomes the single source of truth for data validation and authorization, simplifying future updates.FormRequest testing tools (e.g., create(), assertValid()), reducing test duplication.notifyAuthorizationUsing callback centralizes how authorization failures are communicated to users (e.g., toast notifications, flash messages), reducing ad-hoc error handling in components.parameter() method provides a unified way to access route/model parameters, simplifying support for edge cases (e.g., missing parameters in Livewire).InvalidArgumentException. Teams should implement global error handling (e.g., via the notifier callback) to avoid raw exceptions.FormRequest, but changes to the component’s public properties (e.g., renaming $firstName to $userFirstName) may break validation unless the FormRequest is updated accordingly.FormRequest will adapt quickly. Livewire developers may need training on:
validateLivewire() method and parameter injection.parameter() system for accessing route/model data.FormRequest and Livewire validation.How can I help you explore Laravel packages today?