定制 siam401/api-utils 二次开发

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

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

siam401/api-utils

最新稳定版本:v1.0.0

Composer 安装命令:

composer require siam401/api-utils

包简介

A Laravel package for file uploads.

README 文档

README

A simple Laravel helper to standardize API JSON responses.

📦 Installation

composer require siam401/api-utils

🚀 Usage

Import the class:

use Siam401\ApiUtils\ApiUtil;

✅ Success Response

return ApiUtil::success('Fetched successfully', $data);

❌ Failure Response

return ApiUtil::failure('Something went wrong', 400, ['field' => 'error']);

💥 Crash Response

return ApiUtil::crash('Unexpected system error', 500, ['exception' => $e->getMessage()]);

🔍 Not Found Response

return ApiUtil::notFound('Record not found');

📁 Response Format

All responses follow a consistent structure:

{
  "message": "Description",
  "contents": {...}
}

🛠️ Requirements

  • PHP ^8.0
  • Laravel 9 or 10

📄 License

This package is open-source software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-24