surprisehighway / craft-support
Reports PHP, database, and plugin versions to the Surprise Highway hub.
Package info
github.com/surprisehighway/SH-Support
Type:craft-plugin
pkg:composer/surprisehighway/craft-support
Requires
- php: >=8.2
- craftcms/cms: ^5.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Two small plugins, one for Craft CMS 5 and one for WordPress, that return the same JSON report about a site's runtime: CMS version, PHP version and limits, web server, database server version, loaded PHP extensions, server resources and pending OS updates, installed plugins, and (Craft only) the system report. The Surprise Highway hub polls this endpoint. Nothing in this repo pushes data anywhere.
composer.json Craft package surprisehighway/craft-support (must stay at the root)
craft/src/ Craft plugin source
craft/README.md Craft install
wordpress/ WordPress plugin, copied to wp-content/plugins/surprise-highway-support
wordpress/README.md WordPress install
server/ Optional root cron script for OS update and reboot status (see server/README.md)
The Craft composer.json lives at the repo root because Composer VCS repositories only read the root. wordpress/ and server/ are excluded from Composer archives and GitHub zipballs.
The Craft plugin handle is _surprise-highway-support. The leading underscore makes it a Craft private plugin, which keeps it out of Plugin Store license and update checks. The WordPress plugin slug has no underscore.
Both plugins are MIT licensed (see LICENSE.md).
Releases
Releases are git tags shared by both plugins, for example 1.0.1. Do not add a version field to composer.json; Packagist reads versions from tags.
- Bump
Version:inwordpress/surprise-highway-support.phpto the new tag. - Add a
CHANGELOG.mdentry. - Commit, tag, and push the tag:
git tag 1.0.1 && git push origin main 1.0.1.
Packagist
Craft sites install from Packagist so they need no repositories entry and no GitHub token. One-time setup, after the first tag is pushed:
- Sign in to Packagist with the Surprise Highway account and submit
https://github.com/surprisehighway/SH-Supportat packagist.org/packages/submit. Packagist reads the rootcomposer.jsonand lists it assurprisehighway/craft-support. - Keep it updated automatically. Either sign in to Packagist with GitHub so the Packagist GitHub integration syncs on push, or add a webhook in the GitHub repo settings: payload URL
https://packagist.org/api/github?username=<packagist-username>, content typeapplication/json, secret set to the Packagist API token from your Packagist profile, push events only. - Push a tag and confirm the new version appears on the package page within a minute or two.
Until the package is on Packagist, Craft sites add the public repo as a vcs repository (see craft/README.md).
Endpoints
| CMS | URL |
|---|---|
| Craft | https://example.com/actions/_surprise-highway-support/report |
| WordPress | https://example.com/wp-json/surprise-highway-support/v1/report |
Craft sites that change the actionTrigger config setting use that trigger in place of actions.
Token
Each site has its own token, stored on the website entry in the hub and in the site's environment as SH_SUPPORT_TOKEN. Never put it in the query string, project config, a Craft field, or a WordPress option.
openssl rand -hex 32
- Craft reads
SH_SUPPORT_TOKENwithApp::env(), so.env, Forge, and DeployHQ environment variables all work. - WordPress reads a
SH_SUPPORT_TOKENconstant first (forwp-config.php, which is the practical option on WP Engine), then the environment variable. - Tokens shorter than 32 characters are treated as missing.
Request
GET with the token in either header:
Authorization: Bearer <token>X-SH-Support-Token: <token>, used whenAuthorizationis absent or not a Bearer value
Some Apache and FastCGI setups strip the Authorization header before PHP sees it. Either rely on X-SH-Support-Token or add this to .htaccess:
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
curl -sS -D - \ -H "Authorization: Bearer $SH_SUPPORT_TOKEN" \ -H "X-SH-Support-Token: $SH_SUPPORT_TOKEN" \ -H "Accept: application/json" \ "https://example.com/actions/_surprise-highway-support/report"
Responses
Every response sends Cache-Control: no-store.
| Status | Body | When |
|---|---|---|
| 200 | Report below | Token matches |
| 401 | {"error":"unauthorized"} |
Header missing or token wrong |
| 404 | {"error":"notFound"} |
SH_SUPPORT_TOKEN missing, empty, or under 32 characters |
| 405 | {"error":"methodNotAllowed"} |
Craft only, non-GET request |
| 500 | {"error":"reportFailed"} |
Unexpected failure; details go to the server log only |
Report contract
schemaVersionis the integer1.cmsiscraftorwordpress.- Every key is always present.
nullmeans the value does not apply. phpvalues are rawini_get()strings (256M,-1), not integers.mysqlVersionis the raw server string from the database (8.0.36,10.11.6-MariaDB-log). It is not the WordPress schema revision and is not normalized.plugins[].installedisfalsefor Craft plugins Composer has pulled in but nobody has installed. It is alwaystrueon WordPress.plugins[].packageis the Composer package on Craft andnullon WordPress.plugins[].updateAvailableisnullon Craft. On WordPress it is the version from the existingupdate_pluginstransient; the report never calls wordpress.org.- WordPress must-use plugins are listed with a
mu:handle prefix andenabled: true. webServeris the rawSERVER_SOFTWAREstring (nginx/1.24.0,Apache). Apache often hides its version, and behind a proxy it names the server that runs PHP, not the public one.nullif unset.extensionsis the list of loaded PHP extension names fromget_loaded_extensions(), sorted case-insensitively.serveris read live on each request:hostname,os(PRETTY_NAMEfrom/etc/os-release),kernel,cpuCount,loadAverage(1, 5, 15 minutes),memoryTotal/memoryAvailableanddiskTotal/diskFree(bytes; disk is the partition holding the site). Each value isnullwhen the host blocks it (open_basedir, disabled functions, no/proc). On managed and container hosts these can describe the host machine, not the site. Every site on a server reports the same values, so group byhostname.server.updatescomes from the optional cron script inserver/:checkedAt,available,security,rebootRequired,rebootPackages. The whole object isnullwhen the script is not installed. Treat acheckedAtolder than a couple of hours as stale.- The report never includes
phpinfo; it exposes too much server config to redact reliably. Use Craft's Utilities > PHP Info or WordPress's Tools > Site Health > Info on the site itself. systemReportis the Craft Utilities > System Report HTML.nullon WordPress or if rendering fails.reportedAtis UTC ISO-8601.
Treat systemReport as untrusted HTML. Render them only in a sandboxed frame or as escaped source.
{
"schemaVersion": 1,
"cms": "craft",
"cmsVersion": "5.8.18",
"phpVersion": "8.3.24",
"webServer": "nginx/1.24.0",
"mysqlVersion": "8.0.36",
"databaseDriver": "MySQL",
"php": {
"memoryLimit": "256M",
"uploadMaxFilesize": "32M",
"postMaxSize": "32M",
"maxExecutionTime": "120",
"maxInputVars": "1000"
},
"extensions": ["Core", "curl", "date", "imagick", "intl", "json", "mbstring", "pdo_mysql", "Zend OPcache"],
"server": {
"hostname": "web-1",
"os": "Ubuntu 24.04.1 LTS",
"kernel": "6.8.0-48-generic",
"cpuCount": 2,
"loadAverage": [0.42, 0.31, 0.28],
"memoryTotal": 4110417920,
"memoryAvailable": 2289299456,
"diskTotal": 84278272000,
"diskFree": 51539607552,
"updates": {
"checkedAt": "2026-10-21T15:17:00Z",
"available": 12,
"security": 5,
"rebootRequired": true,
"rebootPackages": ["linux-image-6.8.0-49-generic"]
}
},
"plugins": [
{
"name": "CKEditor",
"handle": "ckeditor",
"package": "craftcms/ckeditor",
"version": "4.11.4",
"installed": true,
"enabled": true,
"updateAvailable": null
}
],
"systemReport": "<div class=\"readable\"><h2>Application Info</h2>...</div>",
"reportedAt": "2026-10-21T15:45:00Z"
}
{
"schemaVersion": 1,
"cms": "wordpress",
"cmsVersion": "6.8.2",
"phpVersion": "8.2.28",
"webServer": "Apache",
"mysqlVersion": "10.11.6-MariaDB-log",
"databaseDriver": "MariaDB",
"php": {
"memoryLimit": "512M",
"uploadMaxFilesize": "64M",
"postMaxSize": "64M",
"maxExecutionTime": "300",
"maxInputVars": "4000"
},
"extensions": ["Core", "curl", "date", "exif", "gd", "json", "mbstring", "mysqli", "Zend OPcache"],
"server": {
"hostname": "pod-123456",
"os": null,
"kernel": "5.15.0-1057-gcp",
"cpuCount": 8,
"loadAverage": [1.2, 1.05, 0.98],
"memoryTotal": 33671938048,
"memoryAvailable": 12884901888,
"diskTotal": 107374182400,
"diskFree": 64424509440,
"updates": null
},
"plugins": [
{
"name": "Akismet Anti-spam",
"handle": "akismet/akismet.php",
"package": null,
"version": "5.3.7",
"installed": true,
"enabled": true,
"updateAvailable": "5.4"
}
],
"systemReport": null,
"reportedAt": "2026-10-21T15:45:00Z"
}
Out of scope
The hub poller lives in the hub repo.