PHPackages                             guozhijian611/thinkorm-log - 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. [API Development](/categories/api)
4. /
5. guozhijian611/thinkorm-log

ActiveLibrary[API Development](/categories/api)

guozhijian611/thinkorm-log
==========================

基于webman开发的ThinkOrm日志记录插件，增强版支持API请求日志记录

15PHP

Since Jun 6Pushed 11mo agoCompare

[ Source](https://github.com/guozhijian611/thinkorm-log)[ Packagist](https://packagist.org/packages/guozhijian611/thinkorm-log)[ RSS](/packages/guozhijian611-thinkorm-log/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

基于 webman 的ThinkOrm和 API日志记录
============================

[](#基于-webman-的thinkorm和-api日志记录)

基于 [webman](https://www.workerman.net/webman) 使用ThinkOrm时的日志记录工具，同时支持API请求日志记录 本插件基于 saithink/thinkorm-log 二次开发，由 guozhijian611 增强API日志功能

功能特性
====

[](#功能特性)

- ThinkOrm SQL查询日志记录
- API请求响应日志记录
- 支持控制台输出和文件记录
- 可配置开关控制
- 美化的日志输出格式
- 支持忽略特定路径
- 统一的Bootstrap注册方式

安装
==

[](#安装)

composer环境的安装命令如下

```
composer require guozhijian611/thinkorm-log
```

安装之前确保已安装webman

配置文件
====

[](#配置文件)

基础配置：`config/plugin/guozhijian611/thinkorm-log/app.php`

```
return [
    // 是否启用日志记录
    'enable' => true,
    // 是否输出到控制台
    'console'   => true,
    // 是否记录到日志文件
    'file'  => false,

    // API日志配置
    'api_log' => [
        // 是否启用API日志
        'enable' => true,
        // 是否输出到控制台
        'console' => true,
        // 是否记录到日志文件
        'file' => false,
        // 忽略的路径（支持字符串匹配）
        'ignore_paths' => [
            'logs',
            'logview',
            '/logs',
            '/logview/'
        ]
    ]
];
```

日志输出示例
======

[](#日志输出示例)

SQL日志
-----

[](#sql日志)

``` [2024-01-01 12:00:00]SELECT * FROM users WHERE id = 1 [0.001s] ``` API日志
-----

[](#api日志)

``` ┌────────────────────────2024-01-01 12:00:00─────────────────────────── │ 状态码: ✅ 200 │ 请求方式: POST │ 接口: http://localhost:8787/api/user/login │ 耗时: 25.67ms │ 参数: { │ "username": "admin", │ "password": "123456" │ } │ 响应数据: { │ "code": 0, │ "msg": "登录成功", │ "data": { │ "token": "xxx" │ } │ } └──────────────────────────────────────────────────── ``` 日志文件
====

[](#日志文件)

- SQL日志文件：`runtime/logs/sql.log`
- API日志文件：`runtime/logs/api.log`

工作原理
====

[](#工作原理)

插件通过 Bootstrap 类统一注册所有功能：

- SQL日志：通过 `Db::listen()` 监听数据库查询
- API日志：通过中间件配置文件注册全局中间件
- 配置控制：通过配置文件控制各功能的开关

作者
==

[](#作者)

- 原作者：saithink
- 增强版作者：guozhijian611
- 项目地址：[](https://github.com/guozhijian611/thinkorm-log)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 86.7% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ee66e96df93e44fb11d58f884accd5ad871ef07a537fae85db2194aa7a37589?d=identicon)[guozhijian611](/maintainers/guozhijian611)

---

Top Contributors

[![guozhijian611](https://avatars.githubusercontent.com/u/176473252?v=4)](https://github.com/guozhijian611 "guozhijian611 (13 commits)")[![saithink](https://avatars.githubusercontent.com/u/46062256?v=4)](https://github.com/saithink "saithink (2 commits)")

---

Tags

apilogthinkormwebman

### Embed Badge

![Health badge](/badges/guozhijian611-thinkorm-log/health.svg)

```
[![Health](https://phpackages.com/badges/guozhijian611-thinkorm-log/health.svg)](https://phpackages.com/packages/guozhijian611-thinkorm-log)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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