mvaliolahi/request-hydrator

Laravel Request Hydrator Package.

Installs: 553

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 1

Forks: 0

Open Issues: 3

pkg:composer/mvaliolahi/request-hydrator

v1.0.4 2023-03-01 14:28 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)
]);