1. Go to this page and download the library: Download rocareer/webman-status-code library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rocareer / webman-status-code example snippets
use support\StatusCode;
// 中间件/服务内抛业务异常(消息为中文提示,码为业务状态码,全局异常处理器统一转响应)
throw new UnauthorizedHttpException('凭证已过期 请重新登录', StatusCode::TOKEN_EXPIRED);
// 取任意码的中文消息(未登记返回 '未知错误')
$msg = StatusCode::getMessage(StatusCode::NO_TOKEN);