PHPackages                             wss0823/module-log-middleware - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. wss0823/module-log-middleware

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

wss0823/module-log-middleware
=============================

Uniondrug Module Log Middleware Component for uniondrug/framework

1.0(4y ago)015proprietaryPHP

Since Jul 21Pushed 4y ago1 watchersCompare

[ Source](https://github.com/wss0823/module-log-middleware)[ Packagist](https://packagist.org/packages/wss0823/module-log-middleware)[ RSS](/packages/wss0823-module-log-middleware/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

日志中间件
=====

[](#日志中间件)

安装
--

[](#安装)

```
composer require wss0823/module-log-middleware
```

> 中间件依赖 `uniondrug/middleware` 中间件基础组件。

修改 `app.php` 配置文件，加上Middleware服务，服务名称`LogMiddleware`

```
return [
    'default' => [
        ......
        'providers'           => [
            ......
             \Uniondrug\Middleware\MiddlewareServiceProvider::class,
            \Uniondrug\ModuleLogMiddleware\LogMiddleware::class,
        ],
    ],
];
```

增加配置文件 `middleware.php`,加入如下配置

```
return [
    'default' => [
        // 应用定义的中间件
        'middlewares' => [
            // 注册名为token的中间件
            'addLog' => \Uniondrug\ModuleLogMiddleware\LogMiddleware::class,
        ],
        // 将token中间件放在全局中间列表中
        'global' => [
            'addLog'
        ],
        'addLog' => [
            'whitelist' => [
                //请求controllers 路由名称
                'amap' => [
                    //请求function 路由名称 & 路由备注
                    'search' => '地图查询',
                ],
            ]
        ]
    ]
];
```

在db注册的数据库中增加如下表

```
CREATE TABLE `http_log` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  `request_id` varchar(32) NOT NULL DEFAULT '' COMMENT '请求链id',
  `http_url` varchar(32) NOT NULL DEFAULT '' COMMENT '请求地址',
  `http_url_content` varchar(240) NOT NULL DEFAULT '' COMMENT '请求地址简介',
  `user_agent` varchar(240) NOT NULL DEFAULT '' COMMENT '请求来源',
  `ip` varchar(120) DEFAULT '' COMMENT 'IP地址',
  `request_body` text COMMENT '请求入参json',
  `gmt_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `gmt_updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`),
  KEY `idx_request_id` (`request_id`) USING HASH COMMENT '请求链',
  KEY `idx_http_url` (`http_url`) USING HASH COMMENT '请求地址',
  KEY `idx_user_agent` (`user_agent`) USING BTREE COMMENT '请求来源'
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COMMENT='请求日志表';
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1754d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5cd6edde9012a99962f94a0cd5e92666ff0a5b995489281d52a896bfdc5dfde2?d=identicon)[wss0823](/maintainers/wss0823)

---

Tags

logmiddlewarephalcon

### Embed Badge

![Health badge](/badges/wss0823-module-log-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/wss0823-module-log-middleware/health.svg)](https://phpackages.com/packages/wss0823-module-log-middleware)
```

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[symfony/monolog-bundle

Symfony MonologBundle

2.9k249.1M1.6k](/packages/symfony-monolog-bundle)[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
