Releases: surazdott/api-response
Releases · surazdott/api-response
v1.2.3
v1.2.2
v1.2.1
v1.2.0
Added: paginate Helper Method
A new helper method has been added to enhance API response handling:
paginate(string $message, mixed $data = [])
public function index()
{
$users = UserResource::collection(User::active()->paginate(10));
return api()->success('Data fetched successfully.', $users);
}
// Result
{
"success": true,
"message": "Request processed successfully.",
"total": 20,
"total_pages": 2,
"per_page": 10,
"data": [
{
"id": 1",
"name": "Suraj....",
},
{
"id": 2",
"name": "Rabin....",
}
]
}
v1.1.2
v1.1.1
feat: Enhance API response handling and error management #4
- Updated README.md to reflect new API response methods and usage examples.
- Modified HasApiResponse.php to include new response methods for server and client errors.
- Updated ApiValidationException.php to improve validation error handling with enhanced messages.
- Adjusted Api.php facade to incorporate new response methods for clarity and consistency.
- Refactored ApiResponse.php to introduce generic and specialized response handling (e.g., serverError, success).
- Enhanced ApiResponseTest.php with additional test cases to cover new response methods.
- Improved ExceptionTest.php to ensure better exception handling and validation errors.
v1.1.0
v1.0.1
- made the response method more generic by @adrorocker #1
- fixed ignore the composer.lock file by @adrorocker #1