smoolabs/wordpress-plugin-updater
Composer 安装命令:
composer require smoolabs/wordpress-plugin-updater
包简介
A library for WordPress plugins, to utilize license verification and auto-updating using WordPress License Server.
README 文档
README
The WordPress Plugin Integration for the WordPress License Server.
Usage
There's two ways you can integrate this and enable automatic updates for your own plugin.
Using Composer
If you're already using Composer, you'll know what to do.
If not, you'll need to install Composer on your computer and run composer init. This will initialize composer in your packages root.
Once that is complete, run this:
composer require smoolabs/wordpress-plugin-updater
Composer will then install the integration into the vendor/ folder.
To include the plugin files now, simply include the vendor/autoload.php file.
<?php require_once 'vendor/autoload.php';
Without Composer
Download this repository as a .zip file and extract it somewhere into your plugin files.
Then just include the loader.php file.
<?php require_once '/path/to/updater/loader.php';
Setup
There's only one thing you'll need to do, to enable the integration once you've included it into your project.
In your plugins main file, paste this code:
$client = \Smoolabs\WPU\V4\WPLSController::initClient('http://url-to-wpls.com', array( 'name' => 'Example Plugin Name', 'version' => '1.0.0', 'path' => __FILE__, 'slug' => 'example-plugin-slug' ));
Now, replace Example Plugin Name with your plugins name, http://update-server-url.com with the URL where you hosted the update server, my-example-plugin with your plugin slug (for example the plugin folders name) and 1.0.0 with your current plugins version.
That's all you have to do! The plugin will now receive automatic updates once you make them available on your server (of course, only if the user supplied a license)!
Disabling functionality until License is entered
You may want to stop your buyers from using your plugin until they have entered their licenses. You can easily disable functionality like this:
// Your Updater instance $client = \Smoolabs\...; if ($client->isActivated()) { /* * The User has activated the plugin. * Add your plugin functionality here. */ } else { /* * The User has *NOT* activated the plugin. * Add activation messages etc here, for example on your plugin settings page. */ }
Please make sure that this complies with Envato's rules on locking fieatures behind licenses! The plugin may not be accepted otherwise.
smoolabs/wordpress-plugin-updater 适用场景与选型建议
smoolabs/wordpress-plugin-updater 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 139 次下载、GitHub Stars 达 11, 最近一次更新时间为 2018 年 02 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 smoolabs/wordpress-plugin-updater 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 smoolabs/wordpress-plugin-updater 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 139
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-11