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 Responder

Laravel Responder Laravel Package

flugger/laravel-responder

Laravel Responder builds clean, consistent API responses with Fractal transformers, automatic exception handling, and flexible serialization. Turn Eloquent models into well-structured JSON with minimal effort and full control.

View on GitHub
Deep Wiki
Context7

A Laravel Fractal package for building API responses, giving you the power of Fractal with Laravel's elegancy.

Frequently asked questions about Laravel Responder
How do I install flugger/laravel-responder in a Laravel application?
Install it with Composer using composer require flugger/laravel-responder. The package supports Laravel package auto-discovery, so the service provider and facade are registered for you. After installing, publish the configuration file with the vendor:publish command so you can adjust the serializer, transformer namespace, and error formatting. Most developers can have a working endpoint within a half-day spike.
Which Laravel and PHP versions does Laravel Responder support?
Support depends on the constraints declared in the package's composer.json and those of its core dependency, league/fractal, so always verify them before committing. The package's comfortable zone is Laravel 8 and 9 on PHP 7.4 to 8.1, while Laravel 10 and 11 support should be treated as unproven until a spike passes. On Laravel 11 you may need a maintained fork or a documented patch. Check the actual test matrix rather than relying on star counts.
How do I configure the serializer, transformer namespace, and error formatting?
Publish the package config file and edit the serializer, transformer namespace, and error format keys. The serializer setting lets you switch Fractal's output style, including JSON:API support, without changing your controllers. Transformer namespace configuration lets the package auto-resolve transformers for your models. This central place for response conventions helps standardize API contracts across teams.
How do I return a Fractal transformer response from a controller?
Use the Respondable trait on your controller and call respond() with a model, collection, or transformer. Transformers extend Flugg\Responder\Transformers\Transformer, so you define the Fractal transform method exactly as you would normally. The package resolves the transformer for Eloquent models implicitly, which keeps CRUD controllers short. For aggregate endpoints or non-Eloquent DTOs you register the transformer explicitly.
What does the Laravel Responder response envelope look like and can I change it?
By default responses follow a consistent envelope with success, status, data, and error keys, which standardizes success and failure handling. The error formatting is configurable through the published config file. Keep in mind that the envelope becomes an external API contract, so changing it later is a breaking change for consumers. Decide on the shape early, especially for a versioned public or partner API.
How do sparse fieldsets and the include and with query parameters work?
Laravel Responder supports sparse fieldsets through the ?include= parameter and eager-load hinting through ?with=. These conveniences let clients request related resources without you hand-coding each variation. The trade-off is that the implicit handling can obscure eager-loading behavior, so review what clients can request. Undisciplined use of these parameters is a credible N+1 query vector.
Does Laravel Responder include pagination metadata automatically?
Yes, paginated results include pagination metadata in the response envelope when you respond with a paginator. This removes the boilerplate of building meta blocks by hand in every controller. The metadata format is part of your API contract, so document it for consumers. If you need a custom meta structure, adjust it in the config and transformer layer.
How does Laravel Responder handle exceptions and validation errors?
The package provides automatic exception handling that converts errors into the same consistent envelope used for successful responses. That means validation failures and thrown exceptions reach clients in a predictable shape instead of ad hoc error payloads. Error formatting is configurable in the published config file. Because it works at the response layer, it composes cleanly with existing middleware and validation.
Is Laravel Responder still maintained, and what happens if upstream goes quiet?
Vendor and maintenance risk is the dominant concern with this package, not code quality. Both Laravel Responder and league/fractal have had slow release cadences, and the package has zero registered dependents, which means a thinner public troubleshooting surface. Decide internally who owns the dependency and whether you have appetite to fork and vendor it. Budget for a maintained fork if you target Laravel 11.
How does Laravel Responder compare to Laravel's JsonResource, and how hard is it to migrate away?
Laravel Responder adds opinionated concerns such as a standard envelope, sparse fieldsets, eager-load hinting, and exception handling that JsonResource leaves to you. It is response-layer-only, so you can run both styles concurrently and migrate endpoint by endpoint rather than rewriting. Because Fractal transformers are portable, they largely survive a move to hand-rolled or JsonResource responses. The envelope itself is the lock-in, since changing it breaks API consumers.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections