Laravel DTO
  • Getting started
  • Creating DTOs
  • Usage
  • TypeScript generator
Powered by GitBook
On this page

Was this helpful?

Getting started

Installing Laravel DTO in your application.

Grab the dependency with Composer

composer require open-southeners/laravel-dto

Create new data transfer object

To create a new DTO class run the following command on your project:

php artisan make:dto CreatePostDataNow

You should have a file with a path like app/DataTransferObjects/CreatePostData.php which looks like this:

<?php
​
namespace App\DataTransferObjects;
​
use OpenSoutheners\LaravelDto\DataTransferObject;
​
final class CreatePostData extends DataTransferObject
{
    public function __construct(
        // 
    ) {
        // 
    }
}
NextCreating DTOs

Last updated 1 year ago

Was this helpful?