承接 justinholtweb/craft-homer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

justinholtweb/craft-homer

Composer 安装命令:

composer require justinholtweb/craft-homer

包简介

Content safety and integrity plugin for Craft CMS. Prevents accidental breakage of content, relationships, assets, and site structure.

README 文档

README

Content safety and integrity for Craft CMS. Prevents accidental breakage of content, relationships, assets, and site structure.

Know what will break before it breaks.

Requirements

  • Craft CMS 5.3.0 or later
  • PHP 8.2 or later

Installation

Open your terminal and run:

composer require justinholtweb/craft-homer

Then go to Settings > Plugins in the Craft control panel and click Install for Homer — or run:

php craft plugin/install homer

Features

Deletion Safety

Before deleting an entry, asset, or category, Homer checks how many other elements reference it and classifies the risk:

  • Safe — no references, safe to delete
  • Low Risk — a few references, warning shown
  • High Risk — many references, confirmation required
  • Critical Risk — heavily referenced, typed confirmation (type DELETE) required

Homer can operate in three modes:

Mode Behavior
Warn Show warnings but allow the action
Confirm Require confirmation before risky actions
Block Prevent risky actions entirely

Relation Safety

Homer builds a usage graph by querying the relations table. For any element, it can tell you:

  • How many other elements reference it
  • Which elements, through which fields
  • Whether any of those referencing elements are live, disabled, or pending

This powers the impact analysis behind every safety check.

Asset Safety

Assets get special treatment. Homer checks:

  • Relation field references (asset fields, image fields)
  • Rich text / CKEditor content references via the search index
  • Unused asset detection for cleanup

Audit Log

Every risky action is logged with:

  • What action was taken (delete, disable)
  • Which element was affected
  • Who performed the action
  • Risk level and reference count at time of action
  • The decision (allowed, warned, confirmed, blocked)

Logs are retained for a configurable number of days (default: 90).

CP Integration

Homer adds to the Craft control panel:

  • Warning modals before dangerous deletions with risk badges, usage breakdowns, and typed confirmation
  • Usage badges on element edit pages showing incoming reference counts
  • Homer section in the CP sidebar with a dashboard and audit log
  • Homer Safety utility with orphaned entry finder, unused asset review, and recent high-risk actions

Permissions

Permission Description
View impact reports Access usage and impact report pages
Bypass safety warnings Proceed past warnings without restriction
Bypass deletion blocks Override block mode (use carefully)
View audit log Access the audit log
Manage Homer settings Change plugin configuration

Configuration

Configure Homer from Settings > Plugins > Homer in the control panel, or create a config/homer.php file:

<?php

return [
    'mode' => 'warn',
    'protectElementTypes' => ['entry', 'asset', 'category'],
    'highRiskUsageThreshold' => 5,
    'typedConfirmationThreshold' => 20,
    'adminBypass' => true,
    'deletionSafety' => true,
    'relationSafety' => true,
    'assetSafety' => true,
    'auditLog' => true,
    'strictEnvironments' => ['production'],
    'auditLogRetentionDays' => 90,
];

Multi-Environment

<?php

return [
    '*' => [
        'mode' => 'warn',
        'adminBypass' => true,
    ],
    'production' => [
        'mode' => 'block',
        'adminBypass' => false,
    ],
    'staging' => [
        'mode' => 'confirm',
    ],
    'dev' => [
        'mode' => 'warn',
    ],
];

The strictEnvironments setting enforces block mode regardless of the mode setting. By default, production is a strict environment.

Settings Reference

Setting Type Default Description
mode string 'warn' Safety mode: warn, confirm, or block
protectElementTypes array ['entry', 'asset', 'category'] Element types Homer checks
highRiskUsageThreshold int 5 References needed for "high risk"
typedConfirmationThreshold int 20 References needed for typed confirmation
adminBypass bool true Let admins bypass all checks
deletionSafety bool true Enable deletion impact checks
relationSafety bool true Enable relation safety warnings
assetSafety bool true Enable asset usage detection
auditLog bool true Enable audit logging
strictEnvironments array ['production'] Environments that force block mode
auditLogRetentionDays int 90 Days to keep audit log entries

How It Works

  1. An editor tries to delete an entry, asset, or category
  2. Homer's CP JavaScript calls the safety check API
  3. The SafetyService evaluates protection rules, user permissions, and impact data
  4. The ImpactAnalysisService queries the usage graph and classifies risk
  5. A SafetyCheckResult is returned: allow, warn, confirm, or block
  6. If not allowed, a modal shows the risk level, usage breakdown, and recommendation
  7. For critical risk, the editor must type DELETE to confirm
  8. On confirmation, a bypass token is generated and validated server-side
  9. The DeletionGuardService acts as the server-side backstop in block mode
  10. The action is recorded in the audit log

Roadmap

Future versions may include:

  • Custom safety rule engine
  • Publish-time validation (missing required relations, assets, fields)
  • Orphaned content detection and cleanup workflows
  • Asset replacement safety (dimension, mime type, filesize checks)
  • URI change impact analysis
  • Field deletion and handle change warnings
  • Recycle bin and restore helpers
  • Queue-based site-wide integrity scans

License

This plugin requires a commercial license. See LICENSE.md.

justinholtweb/craft-homer 适用场景与选型建议

justinholtweb/craft-homer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cms」 「Audit」 「relations」 「craftcms」 「safety」 「content-integrity」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 justinholtweb/craft-homer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 justinholtweb/craft-homer 我们能提供哪些服务?
定制开发 / 二次开发

基于 justinholtweb/craft-homer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 40
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-04-05