mvaliolahi / request-hydrator
Laravel Request Hydrator Package.
v1.0.4
2023-03-01 14:28 UTC
Requires
- mvaliolahi/hydrate: 1.0.5
Requires (Dev)
- laravel/framework: ^10.0
- orchestra/testbench: ^8.0.4
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2024-10-29 18:07:55 UTC
README
Introduction
This package add castTo
and HydrateTo
methods to the request object for facilitate filling Data Transfer Objects.
Install
composer require mvaliolahi/request-hydrator
How to use
$postDTOOne = request()->castTo(PostDTO::class); $postDTOTwo = request()->hydrateTo(PostDTO::class);
Overwrite properties
$postDTO = request()->castTo(PostDTO::class, [ 'title' => ucfirst(request()->title) ]);