定制 jder/psr 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jder/psr

最新稳定版本:0.2.0

Composer 安装命令:

composer require jder/psr

包简介

A response builder for PSR

README 文档

README

A response builder for PSR.

This package includes different response builders based on the JSON response structure specified in JSON Data Errors Response (JDER). With the builders, various kinds of responses can be created easily instead of sending plain text responses.

Installation

Install this package as a dependency in the project:

composer require jder/psr

Quick Start

To create a JSON response, use the following code:

use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Jder\Psr\Json\CreateJsonResponse;

function route(
    Request $request,
    Response $response,
): Response {
    return CreateJsonResponse::success($response)->create();
}

And the response will be shown as below:

{
    "success": true,
    "data": null,
    "errors": []
}

Documentation

For the documentation,please refer to the documentation.

Contributing

For contributing, please refer to the contributing guide.

License

This project is licensed under the terms of the MIT license.

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-16