Download the PHP package mkr/smartdesk-license-client without Composer
On this page you can find all versions of the php package mkr/smartdesk-license-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mkr/smartdesk-license-client
More information about mkr/smartdesk-license-client
Files in mkr/smartdesk-license-client
Package smartdesk-license-client
Short Description License and policy Client-SDK for licensing and updates.
License GPL-3.0-or-later
Homepage https://kronsteiner.gmbh
Informations about the package smartdesk-license-client
SmartDesk License Manager Client (WordPress)
License & policy Client-SDK for licensing, limits and plugin updates.
Provides a tiny REST client, admin settings, secure secret storage, and an optional plugin updater.
- PHP 8.1+
- WordPress (single site & multisite supported)
- Composer package: mkr/smartdesk-license-client
Features
- License verification with 12h caching (forceable)
- Limits & plan mapping (plan, limits[*], expires_at)
- Secure secret storage: encrypted at rest, admin UI never echoes secrets
- Safe logging via smartdesk/debug-logger (PII/keys redacted)
- Multisite-aware: options/secrets isolated per blog; per-blog home_url() in payload
- Optional updater: integrates with WP’s update API (gated by license validity)
- Well-tested: PHPUnit suites for single site & multisite
Requirements
- PHP >= 8.1
- WordPress (recent version)
- Composer
Installation
1. Install via Composer
If used as a WordPress plugin, keep this repository as a plugin folder and run composer install.
2. Activate the plugin
- Upload/checkout the plugin into
wp-content/plugins/SmartDesk-LicenseClient/ - Activate in Plugins → SmartDesk License Manager Client
3. Configure API endpoints (production)
By default the endpoints are defined in the plugin bootstrap:
For production, set your real base/paths.
Best practice is to ship these via your build or a small MU-plugin that defines the constants before this plugin loads.
Admin UI
Settings → SmartDesk License
- Enter the license key (never echoed back; stored encrypted).
- “Verify now” triggers a forced verification (bypasses the 12h cache).
- A status box shows the current verify result.
Public API (what you’ll use from other plugins/themes)
Low-level client (if you need it)
Caching policy
✅ Transport errors, 5xx and 429 are cached (avoid storms).
❌ 4xx (client errors) are not cached.
TTL: 12h (configurable in code).
Secure secret storage
Secrets are stored via Helpers::set_secret/get_secret using HKDF-derived keys:
- Uses WP salts when available; falls back to a generated, persisted master key.
- Transparently migrates legacy plaintext values to encrypted form on first read.
- Admin inputs never echo stored secret values.
Optional: Updater
Enable the updater to feed WordPress’ updater UI based on the license:
Server contract (SDLC_API_UPDATE GET) should return e.g.:
The updater will:
- Verify
smartdesk-core(or your chosen product slug) is valid - Inject an update object if
new_version > SDLC_VERSION
Logging (SmartDesk DebugLogger)
Only active when WP_DEBUG === true. Secrets/keys are automatically redacted.
Multisite behavior
- Per-blog isolation: license key/secret/options are stored per site (no cross-bleed).
Client::verify()sends the current blog’shome_url()in the payload.- A dedicated MS test suite ensures isolation and correct payload.
Testing
This project includes two PHPUnit suites:
- Single-site:
composer test - Multisite:
composer test-ms
Prerequisites
- PHP 8.1+
- Composer
- A MySQL/MariaDB instance for tests (LocalWP works great)
Database config is supplied via phpunit.xml.dist / phpunit.multisite.xml:
Create the DB once:
WordPress core for tests
Point WP_PHPUNIT__WP_DIR to your local WordPress core (downloaded once), e.g.:
Run tests
We pin PHPUnit 9.6 for compatibility with wp-phpunit/wp-phpunit.
Integration example (SmartDesk plugin)
A typical SmartDesk add-on/plugin can:
1. Require the client:
2. Verify license during plugins_loaded or before privileged actions:
3. Enforce limits:
4. (Optional) Enable updater in your plugin bootstrap:
Build & Release
Create a production zip (no dev-deps, optimized autoload):
Artifacts:
smartdesk-license-client.zip(from Composer archive)- Excludes tests, dotfiles, vendor test assets, etc.
Troubleshooting
- “Cannot select database” / “Access denied”
Ensure correct DB credentials and thatwp_testsexists; if using LocalWP, include the port (e.g.127.0.0.1:10016). **ABSPATH**not defined /**wp-settings.php**missing
SetWP_PHPUNIT__WP_DIRto a valid WordPress core folder (the filewp-settings.phpmust exist there).- HTTP 400
**rest_invalid_json**from server
The client retries asapplication/x-www-form-urlencoded. Check server handlers if it persists. - 4xx responses are not cached
This is intentional. 5xx/429 and transport errors are cached to avoid storms.
Security notes
- License key & server secret are stored encrypted (HKDF-derived key, salts or persisted random master).
- Admin UI never renders stored secrets.
- Logger automatically redacts sensitive keys/values.
License
GPL-3.0-or-later. See LICENSE.
Maintainer
SmartDesk (Martin Kronsteiner) — https://kronsteiner.gmbh