lexal/laravel-step-validator

Laravel Step validator.

Maintainers

Package info

github.com/lexalium/laravel-step-validator

pkg:composer/lexal/laravel-step-validator

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v3.0.0 2026-04-23 21:01 UTC

This package is auto-updated.

Last update: 2026-04-23 21:03:39 UTC


README

PHPUnit, PHPCS, PHPStan Tests

This package validates step data on the BeforeHandleStep event from Stepped Form.

Requirements

PHP: >=8.2

Laravel: ^11.0 || ^12.0

Installation

Via Composer

composer require lexal/laravel-step-validator

Usage

Implement ValidatableStepInterface on your step and the the listener will validate step data before the step is handled. The validator passes RulesDefinition data directly to Laravel's validator factory method.

use Lexal\LaravelStepValidator\RulesDefinition;
use Lexal\LaravelStepValidator\Steps\ValidatableStepInterface;
use Lexal\SteppedForm\Steps\RenderStepInterface;

final class CustomerStep implements RenderStepInterface, ValidatableStepInterface
{
    public function getRulesDefinition(mixed $entity): RulesDefinition
    {
        return new RulesDefinition(
            /* rules */,
            /* messages (default - empty array) */,
            /* custom attributes (default - empty array) */,
        );
    }
}

License

Laravel Step Validator is licensed under the MIT License. See LICENSE for the full license text.