PHP code example of alexcane / php-json-response

1. Go to this page and download the library: Download alexcane/php-json-response 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/ */

    

alexcane / php-json-response example snippets


$resp = $new JsonResp(/* array of data */);

if (0 <= $data['number']) $resp->addErrMsg('number must be more than 0');

if ($resp->isError()) die $resp->returnResponse(true);

$resp->returnResponse(true); // JSON string
$resp->returnResponse(); // Array