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 Dto Laravel Package

cerbero/laravel-dto

Cerbero Laravel DTO provides a simple way to define typed data transfer objects in Laravel, with attribute casting, validation, and conversion from arrays, requests, and Eloquent models. It helps keep controllers and services clean by moving data shaping and validation into reusable DTO classes.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Architecture / pattern adoption: Informs whether to introduce a formal DTO layer between transport (HTTP, queues, events, webhooks) and domain logic. Because the package makes a DTO layer cheap to prototype, it supports running a time-boxed spike before committing the whole codebase to a pattern.
  • Build vs. buy vs. borrow: Gives a concrete reference point for comparing spatie/laravel-data, native FormRequests + API Resources, and hand-rolled readonly classes. Useful for pricing out "what do we save if we standardize here?"
  • API contract strategy: Typed payloads, nested DTO casting, and validation in one place support decisions on versioning, backward compatibility, and how much surface area to expose publicly.
  • Scope triage: Helps decide which endpoints and integrations deserve formal DTOs (payments, partner APIs, inbound webhooks) versus which can stay as arrays (internal admin CRUD, scripts).
  • Tooling / onboarding roadmap: If adopted, it implies investment in conventions, linting, examples, and docs — a workstream to plan, not a one-off dependency.
  • Representative use cases: Parsing third-party webhook payloads (Stripe, GitHub, etc.), validating public API requests, queue/job payloads, config objects, and event payloads.
  • Risk hedge: MIT license plus a small surface area means vendoring or forking is a viable fallback if the project stalls — a useful option to keep in the decision record.

When to Consider This Package

  • You are on Laravel and want typed, validated DTOs with nested object/collection casting and array/JSON hydration without adopting a large data framework.
  • Your team is already comfortable with docblock/attribute-driven typing and reflection-based "magic."
  • You need a thin layer quickly and can accept a small, single-maintainer dependency in a non-critical path.
  • You are running a spike or proof-of-concept to evaluate DTO patterns before picking a team standard.
  • Your use case is read-mostly: hydrate inbound arrays/requests into typed objects and serialize back out.
  • Look elsewhere if you need long-term vendor support, broad adoption, or security response guarantees. At ~58 stars and 0 dependents, maintenance and CVE-response risk sit with your team — plan to pin, vendor, or fork.
  • Look elsewhere if you need OpenAPI/schema generation, deep validation integration, or performance guarantees at scale; spatie/laravel-data and native FormRequest/Resource tooling are more mature.
  • Look elsewhere if PHP 8.1+ constructor property promotion and readonly classes already cover your needs with zero dependencies.
  • Skip if your team values explicit, debuggable code over reflection-heavy conventions — onboarding cost will outweigh the boilerplate savings.
  • Skip if DTOs would live on a latency-sensitive path where reflection and lazy casting need benchmarking first.

How to Pitch It (Stakeholders)

  • For executives: "A small, MIT-licensed PHP library that cuts boilerplate for typed data objects in our Laravel services. Cost to trial is near zero; the real risk is that it's a single-maintainer project with limited adoption, so we'd treat it as an internal pattern we can fork, not a strategic vendor." Tie it to outcomes: fewer runtime type errors at service boundaries, faster delivery on API-heavy work, clearer contracts for partner integrations. Ask for a time-boxed spike, not a platform commitment.
  • For engineering: "It gives us typed DTOs with nested casting, validation, and array/JSON hydration in roughly one class per payload — we can stop passing raw arrays across service boundaries." Be explicit about the tradeoffs: reflection-based behavior, small community, no roadmap guarantee. Recommend a bake-off against spatie/laravel-data and plain readonly classes; if adopted, pin a version or vendor the source and assign ownership to the platform team.
  • Framing both audiences: the decision is not "adopt this package forever" — it's "use this as a cheap probe to decide whether a DTO layer earns its place, and only then invest in a supported standard."
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.
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox