定制 thomas-institut/standard-api 二次开发

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

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

thomas-institut/standard-api

Composer 安装命令:

composer require thomas-institut/standard-api

包简介

Standard API responses for use in Thomas-Institut projects

README 文档

README

Standard API responses for use in Thomas-Institut projects.

This library provides a standard way to structure API responses in PHP projects, ensuring consistency across different services.

Installation

You can install the package via Composer:

composer require thomas-institut/standard-api

Usage

Success Response

The SuccessResponse class represents a successful API operation.

use ThomasInstitut\StandardApi\SuccessResponse;

$response = new SuccessResponse();
// $response->result will be ApiResult::Success
// $response->timeStamp will be set to current time

Error Response

The ErrorResponse class represents a failed API operation with a message and an HTTP status code.

use ThomasInstitut\StandardApi\ErrorResponse;

$response = new ErrorResponse('An error occurred', 404);
// $response->result will be ApiResult::Error
// $response->message will be 'An error occurred'
// $response->httpStatus will be 404

Development

Running Tests

To run the tests, use the following command:

composer test

Static Analysis

To run PHPStan for static analysis:

composer phpstan

Code Coverage

To generate a code coverage report (requires Xdebug):

composer test:coverage

License

This project is licensed under the GPL-3.0-or-later License - see the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2026-05-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固