New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

soltancode/return-response

Simple package for returning standard json responses for Laravel.
2,535 5
Install
composer require soltancode/return-response
Latest Version:v1.0.1
PHP:^7.3|^8.0
Laravel:9
Older releases:4 – 8
License:MIT
Last Updated:Sep 30, 2022
Links: GitHub  ·  Packagist
Maintainer: soltancode

ReturnResponse

Simple package for returning standard json responses for Laravel Framework.

Packagist Version Packagist Stars Packagist Downloads Packagist PHP Version Support Packagist License

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.

License

MIT

Related Packages

givebutter/laravel-keyable

Add API keys to your Laravel models

176,380 189
obiefy/api-response

Simple Laravel package to return Json responses.

25,495 173
pollitofive/api-response

Simple Laravel package to return Json responses.

1,359 0
soltancode/send-request

Simple package for Laravel that makes it easy to send HTTP requests and integrat...

2,551 2
negartarh/apiwrapper

Super Fast, Lightweight, Standard, Octane Compatible, and High Customizable pack...

1,215 39

Version History

Version Released PHP Laravel License
v1.0.1 ^7.3|^8.0 ^9.0 MIT
v1.0.0 >=5.3.0 * MIT