PHP code example of rohan0793 / jsend

1. Go to this page and download the library: Download rohan0793/jsend 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/ */

    

rohan0793 / jsend example snippets


return response()->jsend(
    $data = ['foo', 'bar'],
    $presenter = null,
    $status = 'success',
    $message = 'This is a JSend Response',
    $code = 200
);

return response()->resource_fetched(
    $data = ['foo', 'bar']
);

return response()->resource_updated(
	$data = ['foo', 'bar']
);

return response()->resource_updated(
	$data = ['foo', 'bar']
);

return response()->resource_deleted(
	$data = ['foo', 'bar']
);

return response()->jsend_error(
    new \Exception('Some Exception'),
    $message = null,
    $code = null
);