kooba/craft-content-audit
Composer 安装命令:
composer require kooba/craft-content-audit
包简介
Content audit tools for Craft CMS — detect orphaned assets, broken entry references, duplicate slugs, and more.
README 文档
README
Audit your Craft CMS 5 content for common issues. Currently detects:
- Orphaned Assets — files uploaded to a volume that aren't referenced by any entry
More checks coming: broken entry references, duplicate slugs, missing meta descriptions, and more.
Installation
Via Composer (local dev)
-
Clone this repo alongside your Craft project.
-
In your Craft project's
composer.json, add the repository and require the plugin:
{
"repositories": [
{
"type": "path",
"url": "../craft-content-audit"
}
],
"require": {
"kooba/craft-content-audit": "*"
}
}
- Run:
composer update kooba/craft-content-audit php craft plugin/install content-audit
- The Content Audit item will appear in your CP sidebar.
Via Plugin Store (once published)
Search for "Content Audit" in the Craft Plugin Store and click Install.
Usage
- Go to Content Audit in the Control Panel sidebar.
- Click Run Audit.
- Review the results table. Each issue links directly to the offending element so you can fix or delete it.
Extending
Adding a new auditor is straightforward:
- Create a class in
src/auditors/implementingAuditorInterface:
class MyNewAuditor implements AuditorInterface { public function handle(): string { return 'my-check'; } public function label(): string { return 'My Check'; } public function run(): array { /* return AuditIssue[] */ } }
- Register it in
AuditService::init():
$this->auditors = [ new OrphanedAssetsAuditor(), new MyNewAuditor(), // <- add here ];
That's it — the CP table picks it up automatically.
Plugin Store Submission Checklist
- Hosted on GitHub (public repo)
-
CHANGELOG.mdkept up to date - Icon at
icon.svg(square SVG, ideally 150×150) -
composer.jsonextra.craftcms.pluginfields complete - Developer account at id.craftcms.com
- Plugin submitted at plugins.craftcms.com/new
Craft Plugin Store review typically takes a few business days.
Craft 5 Development Notes
Controllers: Do not use requireCpAccess() — it doesn't exist in Craft 5. Use this pattern instead:
protected array|int|bool $allowAnonymous = self::ALLOW_ANONYMOUS_NEVER; public function actionIndex(): Response { $this->requireLogin(); // ... }
Twig templates: Never put double quotes inside a double-quoted string. If the string contains "quotes", use single quotes for the outer string:
{# Wrong — breaks Twig parser #} {{ "Click "Run" to start"|t('plugin') }} {# Correct #} {{ 'Click "Run" to start'|t('plugin') }}
Requirements
- Craft CMS 5.0+
- PHP 8.2+
License
MIT — see LICENSE.md
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2026-06-21