1. Go to this page and download the library: Download obiefy/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/ */
obiefy / api-response example snippets
use API;
...
public function index()
{
$users = User::latest()->take(5)->get();
return API::response(200, 'Latest 5 Users', $users);
}
public function index()
{
$users = User::latest()->take(5)->get();
return api()->response(200, 'Latest 5 Users', $users);
}
use API;
...
public function index()
{
$users = User::latest()->take(5)->get();
return API::response(200, 'Latest 5 Users', $users);
}