Search by

surprisehighway / craft-support

surprisehighway

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

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.1 2026-12-01 15:41 UTC

This package is auto-updated.

Last update: 2026-12-01 15:52:07 UTC


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.

  1. Bump Version: in wordpress/surprise-highway-support.php to the new tag.
  2. Add a CHANGELOG.md entry.
  3. 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:

  1. Sign in to Packagist with the Surprise Highway account and submit https://github.com/surprisehighway/SH-Support at packagist.org/packages/submit. Packagist reads the root composer.json and lists it as surprisehighway/craft-support.
  2. 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 type application/json, secret set to the Packagist API token from your Packagist profile, push events only.
  3. 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_TOKEN with App::env(), so .env, Forge, and DeployHQ environment variables all work.
  • WordPress reads a SH_SUPPORT_TOKEN constant first (for wp-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 when Authorization is 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

  • schemaVersion is the integer 1.
  • cms is craft or wordpress.
  • Every key is always present. null means the value does not apply.
  • php values are raw ini_get() strings (256M, -1), not integers.
  • mysqlVersion is 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[].installed is false for Craft plugins Composer has pulled in but nobody has installed. It is always true on WordPress.
  • plugins[].package is the Composer package on Craft and null on WordPress.
  • plugins[].updateAvailable is null on Craft. On WordPress it is the version from the existing update_plugins transient; the report never calls wordpress.org.
  • WordPress must-use plugins are listed with a mu: handle prefix and enabled: true.
  • webServer is the raw SERVER_SOFTWARE string (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. null if unset.
  • extensions is the list of loaded PHP extension names from get_loaded_extensions(), sorted case-insensitively.
  • server is read live on each request: hostname, os (PRETTY_NAME from /etc/os-release), kernel, cpuCount, loadAverage (1, 5, 15 minutes), memoryTotal/memoryAvailable and diskTotal/diskFree (bytes; disk is the partition holding the site). Each value is null when 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 by hostname.
  • server.updates comes from the optional cron script in server/: checkedAt, available, security, rebootRequired, rebootPackages. The whole object is null when the script is not installed. Treat a checkedAt older 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.
  • systemReport is the Craft Utilities > System Report HTML. null on WordPress or if rendering fails.
  • reportedAt is 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.