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

Laravel Dataobject Laravel Package

czim/laravel-dataobject

Lightweight data objects for Laravel: define typed properties, hydrate instances from arrays, and convert them back to arrays or JSON. A simple way to keep request, config, and domain data structured, consistent, and easy to pass around with minimal boilerplate.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Standardizing data contracts between layers. The package gives teams a conventional base object for moving data across controllers, form requests, service classes, jobs, events, and API resources. This directly supports a decision to stop passing ad-hoc associative arrays around, which is one of the highest-leverage refactors in a growing Laravel codebase.
  • Build vs. buy for internal DTO plumbing. The realistic alternative is hand-rolling a DataObject/Dto base class in-house. This package is best framed as a starting point and reference implementation, not a strategic dependency — it lets you evaluate the shape of a DTO layer in days rather than weeks.
  • API contract hygiene and versioning. Typed objects with controlled serialization make it cheaper to introduce response versioning, deprecate fields, and audit what a given endpoint actually emits — useful ahead of public API launches or partner integrations.
  • Integration and adapter work. When wrapping third-party payloads (webhooks, payment providers, CRMs), a DTO layer isolates external schema drift to one class per integration instead of scattering $payload['foo'] throughout the app.
  • Roadmap enabler for modularization. If the roadmap includes extracting services, splitting a monolith into modules, or moving logic into queued pipelines, typed boundaries are a prerequisite. Adopting a DTO convention now lowers the cost of that later migration.
  • Onboarding and static analysis. Explicit object shapes improve IDE support and PHPStan/Psalm signal, shortening ramp-up time for new engineers and reducing "what keys does this array have?" archaeology.

When to Consider This Package

Consider it when:

  • The team is committed to Laravel and PHP, and wants a lightweight, low-ceremony DTO base rather than a full data-mapping framework.
  • You are early in defining an internal convention and want a proven-shaped reference (attribute casting, array/JSON conversion, flexible construction) to fork or emulate.
  • The dependency footprint matters — a small, MIT-licensed, single-purpose package is easier to justify than a large framework with its own abstractions.
  • You can verify Laravel version compatibility against your target (8/9/10/11) before committing, and you have the appetite to vendor or fork it.
  • The scope is internal and non-critical: internal tooling, admin panels, back-office integrations where a breaking change is recoverable.

Look elsewhere when:

  • Maintenance risk is unacceptable. 11 stars and a single maintainer is a bus factor of one. There is no meaningful community, no security-response process, and version support can silently lag behind Laravel releases. For a payments, auth, or compliance-adjacent path, this is disqualifying without a fork-and-own plan.
  • You need features beyond a base object: integrated validation, automatic type coercion from requests, Eloquent model/collection casting, TypeScript or OpenAPI generation. spatie/laravel-data is the mature, widely adopted option for that surface area.
  • You are on PHP 8.1+. Native readonly classes, constructor property promotion, and enums cover a large share of the DTO use case with zero dependency. That is often the correct build-vs-buy answer and should be evaluated first.
  • The team expects documentation, community answers, and long-term upstream support as a procurement or architecture-review requirement.
  • You want a data layer that will outlive a major Laravel upgrade cycle without internal ownership.

Recommended posture: treat this as a spike candidate, not an adoption decision. Budget a one-to-two day evaluation against the native-PHP baseline and spatie/laravel-data, then decide between (a) copy the pattern into an in-house base class, or (b) adopt a maintained package.

How to Pitch It (Stakeholders)

For executives — the business case in one paragraph: This is a small, free, MIT-licensed utility that standardizes how data moves between parts of our application. The value is defect reduction and velocity: typed, self-describing data objects catch integration errors at development time instead of in production, and they make future work — public APIs, partner integrations, service extraction — measurably cheaper. Cost is near zero and the code is small enough to own outright if the upstream project stalls. The honest caveat: it has a single maintainer and negligible community, so we should not depend on it as infrastructure. Recommendation is a short, time-boxed spike, with the likely outcome being that we adopt the pattern internally rather than the package as a long-term dependency.

For engineering — the practical summary:

  • It provides a base class for standardized-but-flexible data objects: attribute casting, array/JSON conversion, and ergonomic construction — the 80% of DTO boilerplate we would otherwise rewrite per project.
  • It is a thin dependency with a narrow API surface, so the exit cost is low: worst case we fork it, or replace it with native readonly classes, in an afternoon per usage site.
  • Risks to weigh: single maintainer, low adoption, unverified compatibility with our Laravel version, and no guarantees on future framework upgrades.
  • Proposed next step: a time-boxed spike on one integration boundary, benchmarked against (1) plain PHP 8.1 readonly classes and (2) spatie/laravel-data. Decide on the pattern first, the package second.
  • If we adopt, we own the fork, pin the version, and document the internal base class as ours — not as an external dependency.
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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings