PHPackages                             serter35/lto - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. serter35/lto

ActiveLibrary

serter35/lto
============

DTO package for Laravel.

1.0.1(1y ago)112MITPHPPHP ^8.2

Since Feb 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/serter35/lto)[ Packagist](https://packagist.org/packages/serter35/lto)[ RSS](/packages/serter35-lto/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

LTO (Laravel Transfer Object)
=============================

[](#lto-laravel-transfer-object)

Introduction
------------

[](#introduction)

LTO helps you structure and manage data transfer in your application. It simplifies handling incoming request data, ensures type safety, and improves code clarity.

By leveraging DTOs, you can enforce a consistent data structure, prevent unexpected values, and seamlessly integrate with Laravel’s validation, models, and dependency injection.

🚀 **Why Use LTO?**

✅ Full IDE Auto-Completion Support → Since DTOs use typed properties and constructor parameters, your IDE (PhpStorm, VS Code, etc.) can provide full auto-completion while writing code.

✅ Strict Type Safety → Prevents unexpected data structures and makes your code more predictable.

✅ Improved Code Readability → Instead of working with raw request arrays, DTOs give a structured way to handle incoming data.

✅ Seamless Integration with Laravel → Works natively with request validation, dependency injection, and models.

---

Installation
------------

[](#installation)

You can install LTO via Composer:

```
composer require serter35/lto
```

LTO supports **Laravel 10** and **Laravel 11** and requires **PHP 8.2** or **higher**.

Quick Start
-----------

[](#quick-start)

First, create a DTO class:

```
php artisan lto CommentDTO
```

Define the DTO class with the relevant properties.

For example, in the following example, we have created a DTO to store comments:

```
