PHP code example of mvaliolahi / request-hydrator

1. Go to this page and download the library: Download mvaliolahi/request-hydrator 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/ */

    

mvaliolahi / request-hydrator example snippets


$postDTOOne = request()->castTo(PostDTO::class);

$postDTOTwo = request()->hydrateTo(PostDTO::class);

$postDTO = request()->castTo(PostDTO::class, [
    'title' => ucfirst(request()->title)
]);