PHP code example of hosseinkalateh / simple-dto
1. Go to this page and download the library: Download hosseinkalateh/simple-dto library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hosseinkalateh / simple-dto example snippets
bash
php artisan make:dto UserDTO
bash
php artisan make:request-dto RegisterUserRequest --dto=UserDTO
class UserController
{
public function register(RegisterUserRequest $request)
{
$request->validated(); // Validated data just like the laravel core structure
$request->toDto(); // Will return the dto instance
}
}