PHP code example of foothing / uniform-json-responses
1. Go to this page and download the library: Download foothing/uniform-json-responses 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/ */
foothing / uniform-json-responses example snippets
class FooController {
use WrapsResponses;
public function getIndex() {
// Do stuff
return $this->success($dataToBeJSONed, 'Hey! It works.');
}
public function putIndex() {
// Do more bad stuff.
return $this->fail("Doh, this is broken", 500);
}
}