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
Dto Api Bundle

Dto Api Bundle Laravel Package

liquidrazor/dto-api-bundle

A Laravel bundle for building API layers around data transfer objects. It helps structure request and response payloads, keep controllers thin, and maintain consistent, typed data flow between your application and its API endpoints.

View on GitHub
Deep Wiki
Context7

A DTO-first Symfony bundle for building boring JSON APIs with streaming responses and autogenerated OpenAPI documentation.

Frequently asked questions about Dto Api Bundle
Is liquidrazor/dto-api-bundle a Laravel package?
It is best described as a Symfony bundle, not a native Laravel package. It targets Symfony's HttpKernel, DI container, routing attributes, and StreamedResponse; there is no Laravel ServiceProvider or facade. Laravel teams can use its DTO conventions as a reference, but running it directly requires a custom bridge.
How do I install liquidrazor/dto-api-bundle?
Install it with Composer using composer require liquidrazor/dto-api-bundle. In a Symfony app you register the bundle in the bundles configuration and wire services as needed. In Laravel there is no native installer path, so expect to build container and HTTP adapters yourself.
Does it support Laravel 10, 11, or 12?
The package does not ship Laravel service provider or middleware integration, so Laravel version support is not officially declared. v0.1.5 targets Symfony 6.4, 7.x, and 8.x, which implies a compatible PHP version rather than a Laravel release. Treat Laravel compatibility as custom integration work, not a supported matrix.
How does request hydration from Laravel requests work?
Hydration is designed around Symfony requests and arrays, not Laravel's Illuminate Http Request. You can map Laravel request data into arrays and hydrate DTOs manually, but there is no built-in adapter. That mapping layer is your code and should be covered by tests.
Can I use its validation rules inside a Laravel FormRequest?
Validation rules live with the DTOs in the bundle's own conventions, not as Laravel validation rules. You can call the DTO validation and translate errors, or duplicate rules in a FormRequest. Neither path is drop-in, so keep one source of truth to avoid drift.
Does it handle nested DTOs and collections?
Yes, the bundle supports nested DTOs and collections as part of its typed data model. That helps model complex API payloads without leaking arrays through controllers. In Laravel you would still need to serialize and validate through the bundle's flow rather than Eloquent resources.
What about consistent JSON serialization?
The package provides consistent JSON serialization from DTOs so responses share one shape. This is useful for contract-stable APIs and for generating specs from the same source of truth. If you stay in Laravel, compare it with spatie/laravel-data and API Resources before adding a bridge.
Is it production-ready and maintained?
The project has very low adoption, zero stars, no dependents, and no security disclosure history, so production risk is high. v0.1.5 shows the maintainer is still tracking Symfony releases, which reduces immediate bit-rot risk. It does not prove a roadmap, bus factor, or stable API, so pin exact versions.
What are alternatives for Laravel DTO APIs?
In Laravel the common stack is spatie/laravel-data for DTOs plus dedoc/scramble for OpenAPI generation. Those packages integrate with Laravel's container, validation, and HTTP layer natively. liquidrazor/dto-api-bundle is more useful as a reference implementation of the same convention.
How should I test or evaluate it before adopting?
Start with a small proof of concept that hydrates a nested DTO, validates it, and serializes JSON. If you are on Laravel, time-box a bridge spike and measure the adapter code you must own. Review composer constraints to confirm whether v0.1.5 widened or replaced Symfony 6.4 and 7.x support, then pin exactly.
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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons