定制 bensomething/craft-dub 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

bensomething/craft-dub

最新稳定版本:1.0.3

Composer 安装命令:

composer require bensomething/craft-dub

包简介

Create Dub short links for your entries.

README 文档

README

Create Dub short links for your entries.

Requirements

  • A Dub account (affiliate link) and API key. Learn more.
  • Craft CMS 5.0.0 or later.
  • PHP 8.2 or later.

Installation

To install the plugin, search for "Dub" in the Craft Plugin Store, or install manually using composer.

composer require bensomething/craft-dub

Then install the plugin via the Craft control panel under Settings → Plugins, or from the terminal:

php craft plugin/install dub

Configuration

  1. Go to Settings → Plugins → Dub in the Craft control panel.
  2. Enter your Dub API key. You can use an environment variable (e.g. $DUB_API_KEY).
  3. After saving your API key, the Domain section will display a dropdown of your available domains.

Usage

Once configured, a Short Link panel will appear in the sidebar of any entry that belongs to a section with URLs.

  • Creating a short link: enter a custom slug in the Short Link sidebar section and save the entry. If left blank, no short link is created.
  • Updating a short link: update the short link slug in the sidebar and save. The existing Dub link is updated in place.
  • Deleting a short link: a short link will be removed from Dub when an entry is deleted or when a short link slug is removed and the entry is saved.
  • Archiving a short link: a short link will be archived in Dub when an entry is disabled.

Templating

Use the dubLink(entry) Twig function to output a short link in your templates:

{% set shortLink = dubLink(entry) %}
{% if shortLink %}
    <a href="{{ shortLink }}">{{ shortLink }}</a>
{% endif %}

Dub plugin sidebar

Stable Version Total Downloads

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固