Flexible DTO Documentation
Quick Start
The simplest way to configure a DTO is to simply extend the FlexibleDTO
class.
<?php
use Mass6\FlexibleDTO\DataTransferObject;
class UserDTO extends DataTransferObject
{
}
Then, you can use the DTO like this:
<?php
$user = UserDTO::make([
'first_name' => 'John',
'lastName' => 'Doe',
]);
# Access the data using the property names
echo $user->first_name; // John
# Access the data using the magic
echo $user->getFirstName(); // John
# Access the data using automatic camelCase conversion
echo $user->firstName; // John