Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Simple Data Transfer Object

Simple Data Transfer Object Laravel Package

dragon-code/simple-data-transfer-object

dragon-code/simple-data-transfer-object offers a lightweight way to define typed data transfer objects in Laravel and PHP applications, helping you move structured data between layers with less boilerplate and clearer, more predictable code. Ideal for request payloads, API responses, and service bou...

View on GitHub
Deep Wiki
Context7

Simple Data Transfer Objects

Frequently asked questions about Simple Data Transfer Object
What is dragon-code/simple-data-transfer-object used for?
It is a thin convenience layer for defining typed data transfer objects in Laravel and plain PHP applications. You use it to hydrate structured arrays into DTO objects, cast values, and serialize them back when moving data between controllers, services, jobs and API responses. It reduces boilerplate compared with hand-rolled array handling, but it is not architecturally load-bearing.
How do I install dragon-code/simple-data-transfer-object in Laravel?
Installation is a normal composer require dragon-code/simple-data-transfer-object. The real feasibility question is dependency resolution: check the package's composer.json for its PHP and illuminate/support constraints before adding it to a modern Laravel project. If you already use spatie/data-transfer-object or spatie/laravel-data, expect limited added value and possible conflicts.
Is dragon-code/simple-data-transfer-object still maintained?
The technical assessment flags the upstream repository as archived, with a single maintainer, zero dependents and very low star count. That means no expected Laravel or PHP constraint updates, no security response channel, and no downstream users to surface breakage. Treat it as unmaintained code rather than an actively supported dependency.
Does it work with Laravel 11 and Laravel 12?
It was a natural fit for Laravel 9/10-era codebases on PHP 8.0/8.1, but an archived package will not add Laravel 11/12 or PHP 8.3/8.4 constraint updates. Expect Composer conflicts within one upgrade cycle. For a Laravel 11/12 target, prefer native readonly classes with a small internal trait or a maintained package such as spatie/laravel-data.
What is the difference between this package and spatie/data-transfer-object?
The package is a thin wrapper in the Spatie DTO lineage and likely depends on that lineage, so verify the exact Composer constraints rather than assuming independence. It adds a small hydration and serialization convenience layer, not a fundamentally different DTO model. If you need validation, transformation and OpenAPI-style metadata, spatie/laravel-data is the richer and maintained option.
Can I use native PHP readonly classes instead of this package?
Native PHP 8.2 readonly classes with constructor property promotion cover roughly 80 to 90 percent of what this package provides. The remaining gap is a small hydration and serialization trait that you can keep in-repo. That removes an unmaintained dependency and an extra upgrade surface.
Does it support nested DTOs, collections, Carbon and enum casting?
The assessment specifically asks whether nested DTOs, collections and Carbon or enum casting are supported, because those are the three places hand-rolled DTOs usually fail. Confirm this by reading the source and tests rather than the README marketing. If your payloads are deeply nested or rely heavily on date and enum casting, test those paths before committing to the package.
Is it safe to use in production given the archived status?
An archived, low-traffic Packagist package is a poor place to trust for a class instantiated on every request. There is effectively no external code review, no security response channel and no canary population to surface regressions. Read the source line by line, check for published advisories and a SECURITY.md, and confirm the Packagist namespace is still controlled by the maintainer.
Should I vendor the source instead of requiring it from Packagist?
Vendoring is the preferred integration path: copy the handful of MIT-licensed classes into app/Data/Support/ with the attribution notice preserved. That converts an unmaintained external dependency into auditable in-repo code and removes the upgrade and supply-chain risk. The package's surface area is small enough for this to be practical.
How do DTOs fit with form requests, Eloquent and queued jobs?
DTOs sit at the seam between HTTP requests, domain services, Eloquent and queued jobs, which is where they genuinely reduce array-shape drift. In practice you hydrate a DTO from a validated form request payload, pass it into a service, and serialize it back for API responses or job payloads. The package's value is this convenience layer, not any deep Laravel integration.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo