Validation
There are different approaches to validate your application’s incoming data.
Form and JSON validation
Additional Resources
- CakePHP Validation (Slim 4 - eBook Vol. 1)
- Symfony Validator (Slim 4 - eBook Vol. 1)
- Problem Details for HTTP API (Slim 4 - eBook Vol. 3)
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
- OpenAPI Validation (Slim 4 - eBook Vol. 3)
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
- XML Validation (XML Validation (Slim 4 - eBook Vol. 3)
Assertion-Based Validation
For assertion based input/output validation, you may use:
This provides a range of assertion methods for enhanced data validation.