1. Go to this page and download the library: Download farhanwazir/makeresponse library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
//Response will be in array
makeResponse(1);
/** Output
[
'status' => 1
]
*/
//Response will be in json
makeResponse(1, null, null, null, false);
/** Output
{
'status' : 1
}
*/
// makeResponse()->toArray() converts into array and same for json by toJson()
makeResponse()->setStatus(0)->setErrors('You provided input is wrong.')->get()->toArray();
//Response will be in json
MakeResponse::set(1, ['id' => 1, 'name' => 'Farhan Wazir'])->get();
//Response will be in array
MakeResponse::set(0, null, 'Your input is wrong', 'Input error')->get()->toArray();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.