justinholtweb/craft-rat
Composer 安装命令:
composer require justinholtweb/craft-rat
包简介
Track which users made edits to all content types on your Craft CMS site
README 文档
README
Track which users made edits to all content types on your Craft CMS site. Rat logs every element save with user attribution, changed fields, and timestamps — then surfaces that history in a dashboard widget and per-element sidebar panel.
Full documentation: craft-rat.com
Requirements
- Craft CMS 5.3 or later
- PHP 8.2 or later
Installation
Open your terminal and run:
composer require justinholtweb/craft-rat php craft plugin/install rat
Or install via the Craft control panel under Settings > Plugins.
Features
Automatic Edit Tracking
Rat listens for saves on all element types and logs who made the change, what fields were modified, and whether the element was created or updated. Drafts, revisions, propagating saves, and bulk resaves are automatically filtered out.
Supported element types:
- Entries, Assets, Globals, Categories, Tags, Users
- Craft Commerce Products, Variants, and Orders (if Commerce is installed)
- Any custom element type
Dashboard Widget
Add the Recent Edits widget to your dashboard to see a live feed of edit activity across the site. Each row shows the user, element name (linked to its edit page), element type, action (created or edited), and a relative timestamp. The display limit is configurable from 1 to 100.
Element Sidebar
Every element edit page gets an Edit History panel in the sidebar showing the last 10 edits with user photos, action type, changed fields, and timestamps. A "View more..." link loads additional history via AJAX.
Multi-Site Support
Edits are tracked per site, so multi-site installs get accurate per-site history.
How It Works
Rat registers a single Element::EVENT_AFTER_SAVE listener on the base Element class, so all element types are covered without needing individual listeners. Each save is recorded to a rat_editlog database table with the element ID, site ID, user ID, element type, label, and a JSON list of changed field names.
The sidebar uses Element::EVENT_DEFINE_SIDEBAR_HTML to inject edit history into every element edit page. The widget is registered via Dashboard::EVENT_REGISTER_WIDGET_TYPES.
Cleanup
Rat includes a cleanupOldLogs method that removes records older than a given number of days (default 90). This is not scheduled automatically — call it from a console command or cron job if needed:
use justinholtweb\rat\Plugin as Rat; Rat::getInstance()->editTracker->cleanupOldLogs(90);
Configuration
Rat works out of the box with no configuration. Install and go.
License
See LICENSE.md.
justinholtweb/craft-rat 适用场景与选型建议
justinholtweb/craft-rat 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 06 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「Audit」 「changelog」 「Craft」 「craftcms」 「edit tracking」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 justinholtweb/craft-rat 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 justinholtweb/craft-rat 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 justinholtweb/craft-rat 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Log adding/updating/deleting of elements
Doctrine ORM provider for the auditor audit-log library.
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
PB Web Media Audit Bundle for Symfony
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 47
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2026-06-12