laravel-api-response maintained by bhry98
Description
A fluent, extensible, and highly configurable API response toolkit for Laravel applications.
Author
Last update
2026/07/28 11:25
(dev-main)
License
Downloads
701
Laravel API Response
A fluent, extensible, highly configurable API response toolkit for Laravel 11, 12 and 13. Zero configuration to get started, endlessly customizable when you need it.
return api()->created($user);
return api()
->success()
->message('User created.')
->data($user)
->meta(['foo' => 'bar'])
->headers(['X-Foo' => 'bar'])
->send();
📖 Full documentation
bhry98.github.io/packages/laravel-api-response
Installation
composer require bhry98/laravel-api-response
The service provider and the ApiResponse facade alias are auto-discovered - nothing else is required.
Highlights
- A single fluent builder (
api()/ApiResponse) with ready-made HTTP and business response shortcuts. - Fully configurable envelope - renameable keys, optional wrapping, and swappable
default/minimal/mobile/jsonapipresets. - Automatic data detection for models, collections, resources, paginators and DTOs.
- Global metadata, hooks, events, macros and a template system for reusable responses.
- Opt-in rate limiting middleware with a standard
api()->tooManyRequests()envelope. - Opt-in audit logging of requests/responses to the database via a queued job, so logging never slows down a response.
- Opt-in locale resolution middleware (
Accept-Languageheader first, then a configurable user locale column). - Optional exception handler and
response()->json()overrides, and testing assertion macros. - Fully backward compatible with the pre-2.0
BResponseSuccess/BResponseError/... API.
See the full documentation for configuration, usage examples and every extension point.
License
MIT.