2 Star 0 Fork 2

santo / lumen.API

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

基于 Lumen v5.1 搭建Api服务

1. 通过 AfterMiddleware 中间件 , 返回固定格式的数据

{
    "error_code" : 1000,
    "error_msg": "ok",
    "extra": {
        "something" : "something"
    }
}

2. 通过自定义异常处理,返回错误信息

{
    "error_code" : 1001,
    "error_msg": "参数错误"
}

3. 通过事件,写入日志

// $name = 日志文件夹和日志文件名
// $logs = 要写入日志的数据(数组或字符串)

event(new LoggerEvent($name, $logs));

4. 通过 BeforeMiddleware 中间件 , 检测提交的数据是否 json 格式(包含Content-Type: application/json 头)

Comments ( 0 )

Sign in for post a comment

About

基于lumen搭建的服务端API框架 spread retract
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
PHP
1
https://gitee.com/stlee/lumen.API.git
git@gitee.com:stlee/lumen.API.git
stlee
lumen.API
lumen.API
master

Search