There are different approaches to validate your application’s incoming data.

Form and JSON validation

Additional Resources

OpenAPI-based Validation

The league/openapi-psr7-validator package can validate PSR-7 messages against OpenAPI (3.0.x) specifications expressed in YAML or JSON.

Additional Resources

JSON schema validation

The league/json-guard package allows you to validate JSON data against a JSON schema.

XML validation

The DOMDocument::schemaValidate method is able to validate XML files against a XSD schema.

Additional Resources

Assertion-Based Validation

For assertion based input/output validation, you may use:

This provides a range of assertion methods for enhanced data validation.