simple package to help you in handling json responses
- PHP
^8.2
composer require mrizki28/handler-api-response
<?php
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);
}
}
$data array
$message string
$code int
default return 200
$message string
$code int
default return 404
$message string
$th \Throwable
$code int
default return 500
Any ideas are welcome. Feel free to submit any issues or pull requests.
The MIT License (MIT). Please see License File for more information.