abc/api-problem

根据RFC 7807的API问题

0.1.1 2020-03-01 19:18 UTC

This package is not auto-updated.

Last update: 2024-09-23 18:18:16 UTC


README

一个PHP库,用于根据RFC 7870描述API问题。

安装

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();

许可证

MIT许可证(MIT)。更多信息请参阅许可证文件