simplygoodwork/craft-deadlinks
Composer 安装命令:
composer require simplygoodwork/craft-deadlinks
包简介
Fight link rot by automatically redirecting broken links to their archived versions.
README 文档
README
Fight link rot by automatically redirecting broken links to their archived versions.
When a user clicks on a broken external link, they will see a confirmation screen which lets them visit an archived version in the Internet Archive Wayback Machine if available.
The confirmation screen uses a neutral design, but you can can specify your own template if you prefer.
Requirements
This plugin requires Craft CMS 5.3.0 or later.
Craft must be set to run queue jobs automatically.
The plugin needs to make a call to the free Wayback API at the address https://archive.org/wayback/available in case you need to whitelist this on your host.
Installation
To install the plugin, follow these instructions:
composer require "simplygoodwork/craft-deadlinks:^1.0.0" -w && php craft plugin/install deadlinks
for DDEV users:
ddev composer require "simplygoodwork/craft-deadlinks:^1.0.0" -w && ddev craft plugin/install deadlinks
Settings
You must set Craft’s queue to run automatically
Other than that, there’s nothing to configure.
Optional: use a custom confirmation screen
If you want to use a custom confirmation screen, create a /config/deadlinks.php file and set confirmationTemplate to point to a .twig template (relative to your /templates/ folder)
<?php use craft\helpers\App; return [ 'confirmationTemplate' => 'deadlinks-custom-confirmation.twig’, ];
You can use the following variables:
| Twig variable | Type | Description |
|---|---|---|
deadlinks.url |
string |
The dead link URL |
deadlinks.linkStatus |
LinkStatus |
Full link status model (or null) |
deadlinks.archiveUrl |
string|null |
Wayback Machine archive URL if found |
deadlinks.archiveChecked |
bool|null |
Whether archive lookup is complete |
deadlinks.archiveCheckInProgress |
bool |
Whether archive lookup is in progress |
deadlinks.waybackSearchUrl |
string |
URL to search Wayback Machine manually |
How Deadlinks works
- Deadlinks intercepts page render and finds all links
- Relevant links are sent to CheckLink job, which checks URL response code. Any dead links are sent to CheckArchive job, which tries to find version of URL in Internet Archive. This is done via the Craft’s queue so page rendering isn’t slowed down.
- Deadlinks updates the final rendered HTML to point any dead links to the confirmation screen
- CheckLink not finished → show original unmodified URL
- CheckLink finished, CheckArchive not finished → point URL to confirmation screen, but don't show link to archived version
- CheckLink finished, CheckArchive finished and archive found -> point URL to confirmation screen with link to archived version
- CheckLink finished, CheckArchive finished and archive not found or error → point URL to confirmation screen with 'no archive available' message
- Link statuses are stored in
deadlinks_linksDB table so they don’t get re-checked unless needed. If there's a definitive status (archive found/archive not available) then that is used. If there's no definitive status (e.g. error or timeout during last test) then link is checked again. - CLI commands:
-
craft deadlinks/default/statsshows how many links checked and their status
-
craft deadlinks/default/clear-allclears all saved link statuses
Brought to you by Good Work.
simplygoodwork/craft-deadlinks 适用场景与选型建议
simplygoodwork/craft-deadlinks 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 04 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「redirect」 「links」 「archive」 「Craft」 「wayback」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 simplygoodwork/craft-deadlinks 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 simplygoodwork/craft-deadlinks 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 simplygoodwork/craft-deadlinks 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Redirects TYPO3 visitors automatic or with a suggestlink to another language and/or root page.
Link Field Type for Craft CMS
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
Links element Silverstripe
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-13