-
Notifications
You must be signed in to change notification settings - Fork 1
Controllers
KroderDev edited this page Jul 10, 2025
·
1 revision
Base helpers for building API controllers.
Kroderdev\\LaravelMicroserviceCore\\Http\\Controller provides several convenience methods that return standardized JSON responses:
-
apiResponse($data = null, $message = null, $status = 200, $success = true)– low level helper used by all other methods. -
successResponse($data = null, $message = null, $status = 200)– quick way to send successful responses. -
createdResponse($data = null, $message = 'Created')– returns a 201 when a resource is created. -
errorResponse($message, $status = 400, $data = null)– formatted error replies with customizable HTTP status code. -
notFoundResponse($message = 'Not found')– specialization oferrorResponse()returning a 404. -
noContentResponse()– returns an empty 204 response.
These helpers keep your controllers concise and guarantee a consistent API format across services.
Maintained by @KroderDev
💬 Feedback? Open an issue
Last updated: July 1, 2025