treehousetim/lumen-middleware

为lumen提供的各种中间件

v1.0.11 2022-05-06 17:58 UTC

This package is auto-updated.

Last update: 2024-09-06 23:11:55 UTC


README

jsonStandardResponse

提供了一种标准的JSON格式输出方式,无论应用程序发送什么内容

针对所有端点

修改你的 app.php

$app->middleware([
    treehousetim\lumen_middleware\jsonStandardResponse::class
]);

idUUID

自动验证基于路由的url参数中的uuid,第一个参数预期为UUID。仅验证其是否存在且为正确的UUID。

在控制器的方法 __construct 中使用

class MyController extends Controller
{
 public function __construct()
    {
        $this->middleware( 'ID_UUID',
            ['only'=>[
                'get',
                'update',
                'destroy'
            ]]
        );
    }
...
}