The SLSWC Client library enables WordPress plugins and themes to check for updates, manage licenses, and enforce DRM against an SLSWC-powered license server.
Location
libraries/slswc/client/src/
Class Reference
| Class | Description |
|---|---|
Plugin | Plugin updater. Hooks into pre_set_site_transient_update_plugins and plugins_api. Extends GenericSoftwareUpdater. |
Theme | Theme updater. Hooks into pre_set_site_transient_update_themes. Extends GenericSoftwareUpdater. |
GenericSoftwareUpdater | Abstract base class. Manages license details, creates ApiClient and LicenseDetails instances. |
ApiClient | HTTP client. Sends requests to the license server's REST API (/wp-json/slswc/v1/). |
LicenseDetails | License state manager. Reads/writes license details from WordPress options. Tracks activation status, expiry, and environment. |
DRM | Grace-period enforcer. Escalating admin notices and full-page interstitial lock for unlicensed products. |
Helper | Static utilities. File header parsing, environment detection, logging, data formatting. |
SoftwareUpdaterInterface | Interface that Plugin and Theme implement. |
Architecture
Plugin / Theme
|
+-- GenericSoftwareUpdater (base)
| |
| +-- ApiClient (HTTP requests to license server)
| +-- LicenseDetails (license state persistence)
|
+-- DRM (optional, admin-only enforcement)
Namespace
All client classes live in the SLSWC\Client namespace:
use SLSWC\Client\Plugin;
use SLSWC\Client\Theme;
use SLSWC\Client\DRM;
Quick Start
For Plugins
use SLSWC\Client\Plugin;
$client = Plugin::get_instance(
'https://your-license-server.com/',
__FILE__,
array(
'license_key' => get_option( 'my_plugin_license_key', '' ),
'slug' => 'my-plugin-slug',
)
);
$client->init_hooks();
For Themes
use SLSWC\Client\Theme;
Theme::get_instance(
'https://your-license-server.com/',
WP_CONTENT_DIR . '/themes/my-theme',
array(
'license_key' => get_option( 'my_theme_license_key', '' ),
'domain' => site_url(),
)
);
See Plugin Integration and Theme Integration for full guides.
Which Class Do I Need?
| Scenario | Class | Guide |
|---|---|---|
| WordPress plugin with licensing and auto-updates | Plugin | Plugin Integration |
| WordPress theme with licensing and auto-updates | Theme | Theme Integration |
| Custom API integration (non-WordPress or headless) | ApiClient | REST API Overview |
| Copy protection with grace periods and admin lock | DRM (via Plugin) | DRM |
| Checking license state from your own code | LicenseDetails | Auto-Updates |
Tip: You almost never instantiate
ApiClient,LicenseDetails, orDRMdirectly. ThePluginandThemeclasses create them internally. UseDRMconfiguration via thedrmkey in the args array passed toPlugin::get_instance().
Related Pages
- Plugin Integration โ Full integration guide for WordPress plugins
- Theme Integration โ Full integration guide for WordPress themes
- DRM โ Grace periods, admin notices, and interstitial lock
- Auto-Updates โ How update checks work under the hood
- Hooks Reference โ All
slswc_*actions and filters