PHP code example of mrizki28 / handler-api-response

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

    

mrizki28 / handler-api-response example snippets




namespace App\Http\Controller;

use App\Http\Controllers\Controller;
use MRizki28\ApiResponse\ApiResponse;
use App\Models\User;

class ExampleController extends Controller
{
    public function getAllUser()
    {
        $data = User::all();
        return ApiResponse::success($data, 'success get all user', 200);
    }
}