Skip to content

v1.0.0

Choose a tag to compare

@SoloPHP SoloPHP released this 27 Oct 21:28
· 6 commits to main since this release
81114d1

First stable release of Solo Input (solophp/input): typed, validated input DTOs for PHP 8.3+. Mark a class #[Input], declare its fields in the constructor, and the factory reads them from the request, validates and casts the whole input, then calls the constructor.

The API is the one of v1.0.0-RC3, unchanged; two applications have run the release candidates in production.

What 1.0 covers

  • Plain final readonly input classes, built once through their constructor after the whole input is valid.
  • Per-field sources: body or query by factory method, #[FromRoute], #[FromContext], #[FromBody('a.b')].
  • Lossless type casting driven by the declared type, including dates, backed enums, custom casters and #[Cast('decimal')].
  • Every error at once in one ValidationException, keyed by the input path (customer.id, lines.0.qty).
  • Processing stages (#[Normalize], #[Caster], #[PostProcess], #[Generator]), nested inputs and #[Items] lists.
  • Partial updates: Inputs::provided(), Inputs::toArray($input, onlyProvided: true) and #[Input(partial: true)].
  • Field grouping and a JSON-serializable schema() of the input contract.

From now on the public API follows semantic versioning; see Versioning for what it covers.

Install

composer require solophp/input

See the documentation and the full diff since RC3.