stellarwp/harbor
Composer 安装命令:
composer require stellarwp/harbor
包简介
A library that integrates a WordPress product with the Liquid Web licensing system.
README 文档
README
Bundled library that handles licensing, updates, and feature gating for WordPress plugins and themes.
Installation
It's recommended that you install Harbor as a project dependency via Composer:
composer require stellarwp/harbor
We actually recommend that this library gets included in your project using Strauss.
Luckily, adding Strauss to your
composer.jsonis only slightly more complicated than adding a typical dependency, so checkout our strauss docs.
Initialize the library
Initializing the Harbor library should be done within the plugins_loaded action, preferably at priority 0.
Harbor only boots its providers when at least one premium plugin announces itself via the lw_harbor/premium_plugin_exists filter. The filter must be attached before Harbor::init() is called, otherwise the gate inside Harbor::init() short-circuits and the providers, REST routes, admin page, and lw_harbor/loaded action are never registered. The simplest pattern is to add the filter on the line immediately above the Harbor::init() call (as shown below), but anywhere earlier in the request works just as well.
use LiquidWeb\Harbor\Config; use LiquidWeb\Harbor\Harbor; add_action( 'plugins_loaded', function() { /** * Configure the container. * * The container must be compatible with stellarwp/container-contract. * See here: https://github.com/stellarwp/container-contract#usage. * * If you do not have a container, we recommend https://github.com/lucatume/di52 * and the corresponding wrapper: * https://github.com/stellarwp/container-contract/blob/main/examples/di52/Container.php */ $container = new Container(); // Use a plugin basename constant defined in your main plugin file, // e.g. define( 'MY_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ) Config::set_plugin_basename( MY_PLUGIN_BASENAME ); Config::set_container( $container ); // Announce that this premium plugin should bring Harbor online. // Must be added before Harbor::init(). Anywhere earlier in the request works, // but the line above the call is the simplest pattern. add_filter( 'lw_harbor/premium_plugin_exists', '__return_true' ); Harbor::init(); }, 0 );
Translation
Package is using __( 'Invalid request: nonce field is expired. Please try again.', '%TEXTDOMAIN%' ) function for translation. In order to change domain placeholder '%TEXTDOMAIN%' to your plugin translation domain run
./bin/stellar-harbor domain=<your-plugin-domain>
or
./bin/stellar-harbor
and prompt the plugin domain You can also add lines below to your composer file in order to run command automatically
"scripts": { "stellar-harbor": [ "vendor/bin/stellar-harbor domain=<your-plugin-domain>" ], "post-install-cmd": [ "@stellar-harbor" ], "post-update-cmd": [ "@stellar-harbor" ] }
Registering a plugin
Harbor discovers your plugin's embedded key automatically by scanning active plugins for a file named LWSW_KEY.php in the plugin root. No filter registration is required. See the Harbor Integration Guide for more details.
Changelog
This project uses @stellarwp/changelogger to manage its changelog. All notable changes are tracked via changelog entry files in the changelog/ directory.
To add a new changelog entry:
bunx @stellarwp/changelogger add
To compile changelog entries into changelog.txt:
bunx @stellarwp/changelogger write --overwrite-version <version>
Releasing
- Run the Release Prep workflow (
Actions → Release Prep → Run workflow). Supply the target branch, version (e.g.1.2.0), and the release date (e.g.2026-04-29). The workflow bumps theVERSIONconstant, compiles the changelog, and opens a PR automatically. - Review and merge the PR.
- Create a GitHub Release with a new tag in the format
vX.X.Xtargeting the merge commit.
Documentation
Start with Harbor Overview for the full architecture.
Subsystems
- Licensing — Key discovery, API responses, validation workflows, caching.
- Catalog — Product families, tiers, features, the Commerce Portal API.
- Features — Feature types, resolution, strategies, Manager API.
- Cron — Scheduled refresh of catalog and licensing data.
- Frontend — React app, @wordpress/data store, component hierarchy, CSS scoping.
- Notices — Admin notices, legacy license warnings, persistent dismissal.
Architecture
- Unified License Key — Key model, seat mechanics, system boundaries.
- Fat Leader / Thin Instance — Leader election, cross-instance hooks.
- Conventions — Naming conventions for namespaces, packages, identifiers.
API Reference
- REST: License — License endpoints.
- REST: Catalog — Catalog endpoints.
- REST: Features — Feature endpoints.
- REST: Legacy Licenses — Legacy license endpoints.
- Liquid Web Licensing v1 — External licensing API consumed by Harbor.
Guides
- Integration Guide — How to integrate your plugin with Harbor.
- CLI Commands — WP-CLI commands for feature management.
- Testing — PHP tests with Codeception/
slic; E2E tests with Playwright/wp-env.
Plugins with Harbor
| Plugin name | Repository | Distribution | Note |
|---|---|---|---|
| GiveWP | impress-org/givewp | wp.org | |
| LearnDash | stellarwp/learndash-core | Herald | |
| MemberDash | stellarwp/memberdash | Herald | |
| The Events Calendar | the-events-calendar/the-events-calendar | wp.org | tribe-common should be updated first |
| Event Tickets | the-events-calendar/event-tickets | wp.org | tribe-common should be updated first |
| Kadence Memberships Pro | stellarwp/restrict-content-pro | Herald | |
| Kadence Blocks | stellarwp/kadence-blocks | wp.org | |
| Kadence Shop Kit | stellarwp/kadence-shop-kit | Herald | |
| Kadence Theme Kit Pro | stellarwp/kadence-pro | Herald |
stellarwp/harbor 适用场景与选型建议
stellarwp/harbor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 50.52k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 stellarwp/harbor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 stellarwp/harbor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 50.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-03-23