xin/hint
Composer 安装命令:
composer require xin/hint
包简介
API标准化数据格式响应处理器
README 文档
README
介绍
API标准化数据格式响应处理器
安装教程
composer require xin/hint
使用说明
配置文件
<?php
return [
'defaults' => [
'hint' => 'api',
],
'hints' => [
'api' => [],
'web' => [
'dispatch_success_tmpl' => 'common@/dispatch_jump',
'dispatch_error_tmpl' => 'common@/dispatch_jump',
],
],
];
构建提示器实例
<?php
$hint = new \Xin\Hint\HintManager($config);
// 业务失败响应
$hint->error("操作失败");
// 业务成功响应
$hint->success("操作成功");
// 数据结果响应
$hint->result([
[
'name'=>'小明'
]
]);
// 强制使用API提示器
$hint->shouldUseApi();
// 强制使用Web提示器
$hint->shouldUseWeb();
统计信息
- 总下载量: 78
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2022-05-11