abc/api-problem
Lightweight PHP library for representing API errors using RFC 7807 “Problem Details for HTTP APIs”. Create ApiProblem instances with type, title, status, detail, and instance, then serialize to JSON for consistent error responses.
A PHP library to describe API problems according to RFC 7870.
composer require abc/api-problem
use Abc\ApiProblem;
$apiProblem = new ApiProblem(
'http://domain.tld/problem/resource-not-found'),
'Resource Not Found',
404,
sprintf('Resource with id "%s" not found', $id),
$requestUri
);
$json = $apiProblem->toJson();
The MIT License (MIT). Please see License File for more information.
How can I help you explore Laravel packages today?