soltancode / return-response
Simple package for returning standard json responses for Laravel.
Fund package maintenance!
Ko Fi
Installs: 2 307
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.3|^8.0
- illuminate/http: ^9.0
- illuminate/support: ^9.0
This package is auto-updated.
Last update: 2024-10-29 06:36:29 UTC
README
Simple package for returning standard json responses for Laravel Framework.
Installation
composer require soltancode/return-response
Usage
If you use it as class (facade), import this:
use Soltancode\ReturnResponse\Facades\ReturnResponse;
Code example:
// $httpResponse = 200; // $data = ['success' => true]; // $message = "Operation done successfully."; # Using as class: return ReturnResponse::response($httpResponse, $data, $message); # Using as helper: return returnResponse()->response($httpResponse, $data, $message);
Response example:
{ "status_code": 200, "message": "Operation done successfully.", "count": 1, "data": { "success": true } }
Other Packages
SendRequest - PHP cURL class that makes it easy to send HTTP requests and integrate with web APIs.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.