Download the PHP package satheez/api-response without Composer
On this page you can find all versions of the php package satheez/api-response. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download satheez/api-response
More information about satheez/api-response
Files in satheez/api-response
Download satheez/api-response
More information about satheez/api-response
Files in satheez/api-response
Vendor satheez
Package api-response
Short Description Standard API response class
License MIT
Homepage https://github.com/satheez/api-response
Package api-response
Short Description Standard API response class
License MIT
Homepage https://github.com/satheez/api-response
Please rate this library. Is it a good library?
Informations about the package api-response
Standard API response class
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
Installation
You can install the package via composer:
You can publish the config file with:
Usage
Example
Available methods
Success Methods :v:
Method | Status code | Description |
---|---|---|
api()->success() | 200 | Successful get, patch (return a JSON object) |
api()->created() | 201 | Successful record create (return a JSON object) |
api()->updated() | 200 | Successful record update (return a JSON object) |
Error Status :shit:
Method | Status code | Description |
---|---|---|
api()->unauthorized() | 401 | Error Not authenticated |
api()->invalidRequest() | 400 | Error invalid request |
api()->accessDenied() | 403 | Error Not authorized (Authenticated, but no permissions) |
api()->forbidden() | 403 | Error Not authorized (Authenticated, but no permissions) |
api()->notFound() | 404 | Error Not Found |
api()->validationError($message) | 422 | Error Validation |
api()->somethingWentWrong() | 500 | Internal error |
api()->exception($exception) | Error with exception |
Extra methods :man:
Method | Status code | Description |
---|---|---|
api()->error($message, $httpCode) | 422 (default) | Custom Error response |
api()->success($data, $message, $httpCode) | 200 (default) | Custom Success response |
Testing
Credits
- Satheez
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of api-response with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.1
spatie/laravel-package-tools Version ^1.9.2
illuminate/contracts Version ^9.0
spatie/laravel-package-tools Version ^1.9.2
illuminate/contracts Version ^9.0
The package satheez/api-response contains the following files
Loading the files please wait ....