# spatie/data-transfer-object

Data transfer objects with batteries included

Repository: https://github.com/spatie/data-transfer-object
Canonical: https://ross.abutalabs.com/products/data-transfer-object
Homepage: https://spatie.be/open-source
Language: PHP
License: MIT
License Family: permissive
Topics: php, value, objects
Archived: true
Last push: 2022-11-01T08:48:41+00:00

## Health v2 (maintenance only)
Score: 10/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 2876, "days_push": 1401, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: archived
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2227, forks 187 (observed 2026-08-28T04:06:28.847026+00:00)

## What it is
A PHP library for creating data transfer objects (DTOs) that can be constructed from arrays of serialized data, with support for casting, nested objects, and validation attributes. It has been officially deprecated by Spatie, who recommend migrating to spatie/laravel-data or cuyz/valinor.

## Use cases
- create typed data transfer objects in php
- hydrate objects from arrays of serialized data
- cast nested arrays into typed php objects
- map json fields to object properties
- validate dto property values with attributes

## When to choose
- maintaining a legacy PHP 8 codebase already using this package
- you want a lightweight, framework-agnostic DTO base class
- you're willing to fork and maintain it yourself

## When to avoid
- starting a new project - the package is no longer maintained
- using Laravel - prefer spatie/laravel-data
- you need actively supported DTO mapping - prefer cuyz/valinor

## Facets
- artifact type: library
- maturity: abandoned
- function: serialization, developer-tools
- domain: developer-tools, web-development, backend
- platform: php
- tags: data-transfer-object, dto, value-objects, deprecated, spatie

## Member repositories
- spatie/data-transfer-object (main) score 10

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:28.847026+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:44:51.606361+00:00, confidence not recorded.
  - readme: https://github.com/spatie/data-transfer-object (fetched 2026-08-28T04:06:28.847026+00:00, sha f62f84528980)
  - homepage: https://spatie.be/open-source (fetched 2026-08-29T10:25:19.732137+00:00, sha 6ed5abf69535)
  - site_page: https://spatie.be/docs (fetched 2026-08-29T10:25:19.734916+00:00, sha 08e024d86d95)
  - site_page: https://spatie.be/about-us (fetched 2026-08-29T10:25:19.736704+00:00, sha d3cb88e4b34c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
