Phase 16: Releases & Environments
Allow software vendors to attach release metadata to licenses so that clients can check for available updates and download new versions in a controlled way.
Files Written
Section titled “Files Written”src/Models/Release.phpsrc/Repositories/ReleaseRepository.phpsrc/Services/ReleaseService.phpsrc/Repositories/EnvironmentRepository.php
Release Model
Section titled “Release Model”A Release record represents one version of a software package:
$release->version // semver string, e.g. "2.1.0"$release->product_id // associated WC product (or null)$release->channel // stable | beta | rc$release->download_url // pre-signed URL or redirect endpoint$release->checksum // SHA-256 of the downloadable file$release->min_license_status // required license status to download$release->changelog // plain text or Markdown$release->released_at // datetimeUpdate Check Flow
Section titled “Update Check Flow”Clients call GET /wplm/v1/releases/check with their current version and license token:
{ "product_id": 42, "current_version": "2.0.0", "license_token": "eyJ..."}ReleaseService::check_update():
- Validates the license token (7-step algorithm).
- Loads the latest stable release for
product_id. - Compares
current_versionagainstrelease.versionusingversion_compare(). - If a newer version exists, returns the release metadata.
Response:
{ "update_available": true, "version": "2.1.0", "download_url": "https://...", "checksum": "sha256:abc123...", "changelog": "- Fixed bug #123\n- Added feature X"}Download Endpoint
Section titled “Download Endpoint”GET /wplm/v1/releases/{id}/download — requires a valid license token in Authorization: Bearer header. Validates the license before returning a redirect to download_url.
This means the download URL itself can be a private S3 pre-signed URL — WPLM handles the license gate and then redirects.
Environment Tracking
Section titled “Environment Tracking”wp_wplm_environments tracks named deployment environments per license:
$env->license_id$env->name // "production", "staging", "development"$env->machine_ids // array of machine IDs in this environmentEnvironments are optional metadata — they don’t affect seat counting but allow vendors to query “how many production installs does this customer have?”