bhry98 / laravel-api-response
A fluent, extensible, and highly configurable API response toolkit for Laravel 11, 12, 13 and 14.
Requires
- php: ^8.2
- illuminate/contracts: ^11.0|^12.0|^13.0
- illuminate/http: ^11.0|^12.0|^13.0
- illuminate/pipeline: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
Requires (Dev)
- larastan/larastan: ^2.9|^3.0
- laravel/framework: ^11.0|^12.0|^13.0
- laravel/pint: ^1.17
- orchestra/testbench: ^9.0|^10.0|^11.0
- pestphp/pest: ^2.34|^3.0
- pestphp/pest-plugin-laravel: ^2.4|^3.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Laravel API Response
A fluent, extensible API response toolkit for Laravel 11, 12, 13 and 14. Every response your API sends (success, error, validation, pagination, resources) comes out in the same configurable JSON envelope. It works with zero configuration, and you can customize it as far as you need.
composer require bhry98/laravel-api-response
return api()->created($user); return api() ->success() ->message('User created.') ->data($user) ->meta(['version' => 'v1']) ->send();
{
"status": true,
"message": "User created.",
"data": { "id": 1, "name": "Jane" },
"meta": { "version": "v1" }
}
Highlights: ready-made HTTP and business shortcuts, automatic handling of models/resources/paginators, renameable keys and swappable presets (default, minimal, mobile, jsonapi), opt-in exception rendering, rate limiting, audit logging and locale resolution, plus hooks, events, macros and testing assertions.
📖 Documentation
Read the full documentation at bhry98.github.io/packages/laravel-api-response. It covers installation, every response helper, configuration, and every extension point.
For more packages, visit bhry98.github.io/packages.
License
MIT. See LICENSE.