Self validating PHP objects from JSON Schema
git clone https://github.com/aaronbullard/php-schema.git
composer require aaronbullard/php-schema
PhpSchema provides a quick solution to roll objects from JSON Schema.
Objects self validate during construction and when mutated.
In keeping with DDD principles, PhpSchema objects should always be in a valid state. Therefore all required properties must be passed through the constructor. Any optional properties can be passed after instantiation.
Validation is built off of JsonSchema\Validator from justinrainbow/json-schema
- PublicProperties Trait
- MethodAccess Trait
- Converting to Array, Json, or StdClass
- Integrating with non-PhpSchema classes
For more examples, see the tests: