When you pass data to the template engine it will make it possible for you to easily traverse the data. you can then use one of the Handlers to modify the data when you have traversed to the right position.
If you compare the setPartial method example above with bellow you will see that you can very easily traverse the data with object and also format the strings.
echo $obj->family()->x()->firstname;echo $obj->family()->x()->combine(["firstname","lastname"])->format("Str")->stripTags()->ucfirst()// <em>john</em>// John doe
Traversing the feed
You can even traverse arrays:
foreach($obj->family()->children()->fetch()->get()as $row) {echo $row->firstname("Str")->toUpper()."<br>";echo $row->lastname."<br>";}// DAVID Doe// SARA Doe
Handlers
You can access some Handler to make your life easier. There is different ways to access a DTO handler and I will start showing how you can access the Str handler in 2 ways.
Using the last traverse column argument
echo $obj->family()->x()->firstname("Str")->stripTags()->ucfirst();// John
Using the the format method
echo $obj->family()->x()->firstname()->format("Str")->stripTags()->ucfirst();// John
DTO Handlers you can use:
Str: Modify/format strings
Num: Modify/format numbers
Arr: Modify/format arrays
DateTime: Access the PSR Clock and PHP DateTime class object
Using a DTO library in PHP provides benefits such as encapsulating data, enforcing immutability, validating data, facilitating data transformation, maintaining API compatibility, reducing coupling, improving code readability.