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
Api Response

Api Response Laravel Package

dragon-code/api-response

Build consistent Laravel API responses with a fluent, macro-friendly builder. Dragon Code's api-response helps you return success and error payloads, HTTP status codes, and resource collections in a uniform JSON shape, cutting boilerplate and keeping endpoints predictable.

View on GitHub
Deep Wiki
Context7

Package for standardizing the responses from the API of your Symfony based applications.

Frequently asked questions about Api Response
How do I install dragon-code/api-response in a Laravel app?
Install it with Composer using composer require dragon-code/api-response. Because the package ships as a Symfony bundle rather than a Laravel package, do not expect package discovery; Laravel integration means manually registering the service provider, binding the response builder as a singleton, publishing a config/api-response.php file, and adding a facade alias. Budget roughly one to two days for that work, and run a Composer resolution check first against your pinned Laravel and PHP versions.
Does dragon-code/api-response support Laravel 11?
There is no official Laravel support statement in the package or in its v10.0.0 release notes. Laravel shares symfony/http-foundation transitively, so the response envelope classes are plausibly portable, but the bundle registration and container configuration layers are Symfony-specific. Treat Laravel 11 compatibility as unverified and confirm it with a Composer install and a small spike before committing.
How do I return a success response with data and a message?
Use the package's fluent response builder to chain the success payload, a human-readable message, and the HTTP status code, then return the resulting JSON response from your controller. The builder is designed to keep controllers free of hand-built arrays and to produce the same envelope shape on every endpoint. Check the installed version's source or documentation for exact method names, since the v10 changelog does not describe the wire format.
Can I customize error messages and HTTP status codes?
Yes. The package advertises customizable messages and status codes alongside its success and error payloads, so you can return domain-specific text and the correct 4xx or 5xx code through the same fluent interface. Configuration is typically centralised so controllers stay consistent. Verify the exact config keys against the version you install rather than assuming v9 examples still apply.
Does it support pagination and Laravel API resources?
The package lists pagination and resource support for Laravel data, returning pagination metadata in the standard envelope so clients can page predictably. That said, the release history contains no field reports from Laravel users, so test paginated collections and resource wrapping explicitly in your spike. Pay attention to how meta and links are shaped if your front end already consumes Laravel's default paginator JSON.
What changed between v9.1.0 and v10.0.0?
The v10.0.0 release contains exactly two items: a bump of the internal dragon-code/support dependency to 6.0 and a documentation update. There is no migration guide, no breaking-change description, and no statement about PHP, Symfony, or Laravel support. Because the major version signal is inherited from a dependency, review that dependency's changelog and confirm what Composer actually resolves.
Is dragon-code/api-response actively maintained?
It is maintained, but at low velocity: roughly one release in three years, a two-line changelog, and a single named maintainer. There are about 36 stars and zero dependents, so the envelope design has never been stress-tested by a wider community. That is better than an abandoned package but materially riskier than a healthy one, which matters for a long-lived production API.
How should I test API responses built with this package?
Use Laravel's HTTP tests with assertJsonStructure and assertJsonFragment to lock down the envelope shape your clients depend on. Because the package is unvalidated in Laravel, add spike tests for the behavioural unknowns: exception-handler interception, ValidationException rendering, 204 no-content responses, streamed and file downloads, and pagination. Those areas are not addressed by the v10.0.0 release and are where integration surprises usually appear.
What are good alternatives for consistent JSON API responses in Laravel?
Laravel's built-in JsonResponse, API Resources, and paginator already give you a predictable shape with zero extra dependencies. If you want a richer layer, spatie/laravel-data, league/fractal, or a small custom response trait or macro can deliver similar fluent ergonomics while staying Laravel-native. Choose those first unless you specifically need this package's envelope format.
Is dragon-code/api-response safe to use in production?
Not without a spike. The main risks are the Symfony bundle architecture versus Laravel, an opaque major release whose changelog cannot be mapped to behavioural change, and a single-maintainer project with no dependents or field reports. Run a one-day spike covering Composer resolution, the PHP floor, exception handling, and pagination, then decide whether the boilerplate savings justify the review and maintenance cost.
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.
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle