Skip to content
docsv0.17.0

SchemaForm

The public entry point: parse a tool/operation input schema into a FormDefinition, and bind raw input into a typed, validated FormSubmission. A thin facade over SchemaFormParser + FormBinder; `bind` deliberately lives here (and on the binder), never on the FormDefinition value object. SchemaForm neither renders nor executes.

SchemaForm::__construct()

public function __construct(Milpa\Live\Schema\SchemaFormParser $parser = new SchemaFormParser(), Milpa\Live\Schema\FormBinder $binder = new FormBinder()):

Parameters

Parameters of __construct()
NameTypeDescription
$parserMilpa\Live\Schema\SchemaFormParser
$binderMilpa\Live\Schema\FormBinder

SchemaForm::fromSchema()

public function fromSchema(string $id, array $inputSchema): Milpa\Live\Schema\FormDefinition

Parses an input schema into a FormDefinition (delegates to SchemaFormParser).

Parameters

Parameters of fromSchema()
NameTypeDescription
$idstring
$inputSchemaarray<string, mixed>

SchemaForm::bind()

public function bind(Milpa\Live\Schema\FormDefinition $definition, array $rawValues): Milpa\Live\Schema\FormSubmission

Binds raw values against a definition into a FormSubmission (delegates to FormBinder).

Parameters

Parameters of bind()
NameTypeDescription
$definitionMilpa\Live\Schema\FormDefinition
$rawValuesarray<string, mixed>