PHP code example of hassankerdash / laravel-api-respond
1. Go to this page and download the library: Download hassankerdash/laravel-api-respond 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/ */
hassankerdash / laravel-api-respond example snippets
// Generate a successful response
return respond()->success(['key' => 'value'], 'Operation completed successfully');
// Generate an error response
return respond()->error('Bad request');
respond()->error('Bad request')->throwResponse();