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
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-24