rami/problem-detail-bundle
最新稳定版本:v1.1.2
Composer 安装命令:
composer require rami/problem-detail-bundle
包简介
A Symfony bundle that implements application/problem+json to give meaning to api response errors
README 文档
README
RFC 9457: Problem Details for HTTP API deprecated by RFC 9457
Implementation of the RFC 9457 to give meaning to HTTP Response Errors
A simple bundle
Composer installation:
composer require rami/problem-detail-bundle
example use:
use Symfony\Component\HttpFoundation\Response; use Rami\ProblemDetailBundle\ProblemResponse\ProblemJsonResponse; use Symfony\Component\HttpFoundation\JsonResponse; class ArticleController { public function addArticle(): Response { ... if (false === $user->canPostArticle()) { return new ProblemJsonResponse(Response::HTTP_FORBIDDEN, title: "Insufficient permission", detail: "You have insufficient permission to add a new article"); } ... return new JsonResponse(['status' => 'created', 'id' => $article->getId()]); } }
This will return an application/problem+json response
{
"type": "about:blank",
"title": "Insufficient permission",
"status": 404,
"detail": "You have insufficient permission to add a new article"
}
统计信息
- 总下载量: 308
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-17