Flexible DTO Documentation
Introduction
Flexible DTO is a package for creating data transfer objects with validation, property whitelisting, and custom property casting.
The aim is to make it really easy to construct Data Transfer Objects with data properties, and fetch those properties in a type-safe way. The DTOs are flexible in their construction and usage, allowing you to define the properties that are allowed, and the rules for validation and casting.
You can choose to construct a DTO by passing in each property individually like a classic DTO, or via an associative array. Values can be validated and cast to the appropriate types, and you can access the properties using magic getter methods, or by calling the property name as a method. This makes it easy to use the DTOs in your code, and to access the properties without having to define a getter method for each property.