{"repo":"f9webltd/laravel-api-response-helpers","free":true,"listed":false,"github":"https://github.com/f9webltd/laravel-api-response-helpers","clone":"git clone https://github.com/f9webltd/laravel-api-response-helpers.git","description":":rocket: A simple package allowing for consistent API responses throughout your Laravel application","language":"PHP","stars":647,"topics":["laravel-framework","laravel","php"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Laravel API Response Helpers A simple package allowing for consistent API responses throughout your Laravel application. Originally created to solve issues having with a large legacy project, see the package motivation section. Requirements - PHP ^8.2 - Laravel ^12.0 or ^13.0 The package supports actively supported Laravel releases as per the official Laravel Support Policy. Legacy versions of this package support older PHP / Laravel version, see the legacy section. Installation / Usage Simply reference the required trait within your controller: Optionally, the trait can be imported within a base controller. Available methods respondNotFound(string Exception $message, ?string $key = 'error') Returns a 404 HTTP status code, an exception object can optionally be passed. respondWithSuccess(array Arrayable JsonSerializable null $contents = null) Returns a 200 HTTP status code, optionally $contents to return as json can be passed. By default returns ['success' = true] . respondOk(string $message) Returns a 200 HTTP status code respondUnAuthenticated(?string $message = null, ?string $key = 'error') Returns a 401 HTTP status code respondForbidden(?string $message = null, ?string $key = 'error') Returns a 403 HTTP status code respondError(?string $message = null, ?string $key = 'error') Returns a 400 HTTP status code respondCreated(array Arrayable JsonSerializable null $data = null) Returns a 201 HTTP status code, with response optional data respondNoContent() Returns a 204 HTTP stat","default_branch":null,"files":null,"tree":[],"storefront":"/r/f9webltd","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/f9webltd/laravel-api-response-helpers/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}