PHP code example of avertys / json-api-response
1. Go to this page and download the library: Download avertys/json-api-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/ */
avertys / json-api-response example snippets
return JsonApiResponse::make($data)
->withSuccess()
->send(200);
return JsonApiResponse::make($data)
->withSuccess()
->withAdditionalData([
'deprecated' => true
])
->send(200);
return JsonApiResponse::make()
->withErrors($validator->errors())
->withAdditionalData([
'deprecated' => true
])
->send(200);
return JsonApiResponse::make(User::paginate(10))
->withSuccess()
->send(200);