What problem does it solve?
This Skill provides a PHP-based approach to validate and normalize data structures using Nette Schema (Expect). It helps developers ensure configurations are correct, API inputs are sanitized, and runtime data conforms to defined shapes, reducing runtime errors and inconsistencies.
Core Features & Use Cases
- Validate and normalize data structures against a defined schema.
- Support nested structures, arrays, patterns, and type rules.
- Ideal for configuration validation, API input validation, and data processing pipelines in PHP projects leveraging the Nette Schema library.
- Clear, actionable error reporting to guide fixes.
Quick Start
Install the Nette Schema package:
- composer require nette/schema
Create a simple schema and validate data:
- Define a schema with Expect::structure([...]) and use the Processor to validate a data array
- Catch ValidationException to handle invalid input.