Creating DTO Instances
From arrays
$dto = new UserDTO([
'name' => 'John Doe',
'email' => 'john.doe@example.com',
'password' => 's3CreT!@1a2B'
]);$dto = UserDTO::fromArray([
'name' => 'John Doe',
'email' => 'john.doe@example.com',
'password' => 's3CreT!@1a2B'
]);From JSON strings
$dto = UserDTO::fromJson('{"name": "John Doe", "email": "john.doe@example.com", "password": "s3CreT!@1a2B"}');From Request objects
public function store(Request $request): JsonResponse
{
$dto = UserDTO::fromRequest($request);
}From Eloquent Models
From Artisan Commands
From the Command Arguments
From the Command Options
From the Command Arguments and Options
Last updated