Download the PHP package occ-therapist/form-request-validation-for-filament without Composer

On this page you can find all versions of the php package occ-therapist/form-request-validation-for-filament. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package form-request-validation-for-filament

Form Request Validation for Filament

Latest Version on Packagist Total Downloads Tests License GitHub stars

Use Laravel Form Request validation inside Filament — define your rules, messages, and attributes once, reuse them across API routes, controllers, and Filament UI.

Why this plugin?

Filament validates fields through dedicated methods like ->required() and ->email() on each input. That works well for simple forms, but validation logic often belongs in a central place — especially when the same rules already exist in a Form Request.

This plugin bridges that gap: attach a Form Request to your schema or table filters and its validation rules are automatically applied to the matching fields.

Features

Supported contexts

Context API
Resource Create / Edit Schema::formRequest()
Standalone forms / Settings pages Schema::formRequest()
Action modals Schema::formRequest()
Wizards (per-step validation) Schema::formRequest()
Relation managers Schema::formRequest()
Table filters Table::filtersFormRequest()

Requirements

Dependency Version
PHP 8.2+
Laravel 12 or 13
Filament 4.x or 5.x

Installation

Auto-registers via Laravel package discovery. No manual setup required.

Quick start

1. Create a Form Request

2. Attach it to your Filament schema

Important: Call ->formRequest() after ->components() so the validation hook is appended correctly.

Validation errors appear directly on the matching input fields.

API reference

Schema::formRequest()

Parameter Type Required Description
class Closure Yes Returns the Form Request class. Receives $livewire via dependency injection.
mergeInput Closure No Merges additional data into the simulated request input. Receives $state and $livewire.

Context selection

Enriching input data

Useful when Form Requests depend on record data, route parameters, or values not visible in the form.

prepareForValidation()

Runs on the simulated Form Request before rules() are read. Use it to normalize or enrich input that rules() (or getFormRequestValidated()) depends on:

Prepared input is stored for getFormRequestValidated(). Filament still validates the visible form state against the extracted rules — transforms here do not rewrite Livewire field values.

Table::filtersFormRequest()

Same parameters as Schema::formRequest(). Attaches validation to the table's filter form.

Filter mode When validation runs
Deferred (default) When the user clicks Apply
Live (->deferFilters(false)) On every filter change

Usage by context

Resource pages

Action modals

Wizards

One Form Request for the entire wizard — attach it to the root schema:

Only fields in the active step are validated per step. Use mergeInput if rules depend on data from other steps:

Relation managers

For modal actions on the table, attach formRequest() inside the action's schema callback.

Table filters

Field mapping

Rules are matched to fields automatically by name — no per-field configuration needed.

Form Request key Filament field Match type
email TextInput::make('email') Exact
address.street TextInput::make('address.street') Dot notation
items.*.name Repeater child TextInput::make('name') Wildcard
created.from Filter field DatePicker::make('from') in Filter::make('created') Dot notation

State path normalization

Filament uses prefixed state paths internally. The plugin strips these automatically:

Internal state path Resolved key
data.email email
mountedActions.0.data.email email
tableDeferredFilters.created.from created.from

Rule merging

When a field already has Filament validation rules, both sets are merged:

Result: string, required, email, unique:users

Orphan rules

Rules without a matching schema field still run on submit. Failures show a Filament notification instead of an inline field error.

To show the error on a field, add a matching input (visible or hidden):

Accessing validated data

How it works

Limitations

Form Request feature Status
rules() Supported
messages() Supported
attributes() Supported
prepareForValidation() Supported — runs before rules(); prepared input used by getFormRequestValidated() (does not rewrite Livewire field values)
authorize() Not supported — use Filament policies
withValidator() Not supported — Filament owns the validator lifecycle
passedValidation() / failedValidation() Not supported

Testing

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

License

MIT © occTherapist


All versions of form-request-validation-for-filament with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/filament Version ^4.0|^5.0
illuminate/contracts Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
illuminate/validation Version ^12.0|^13.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package occ-therapist/form-request-validation-for-filament contains the following files

Loading the files please wait ...