Skip to content

Installation & Requirements

  • PHP: 8.2 or higher
  • ProcessWire: 3.0.210 or higher
  • First-Party Module Dependencies: None (Htmx is a standalone module)
  • Security Prerequisite: $config->userAuthSalt in site/config.php must be at least 16 characters long (required by SignedStateCodec HKDF-SHA256 signing)
  • Optional CLI Integration: trk/processwire-console for make:htmx:component, make:htmx:ui, and htmx:cache:clear
  1. Require the package from your project root:

    Terminal window
    composer require trk/processwire-htmx
  2. Refresh and install Htmx:

    Terminal window
    php vendor/bin/wire module:refresh
    php vendor/bin/wire module:install Htmx

Once installed, Htmx registers $this->wire()->htmx and $this->wire()->htmxCache automatically. Configure module settings at Modules -> Configure -> Htmx as needed.

Property Default Description
endpointUrl '/hx/req' Unified URL path handled by Htmx::handleEndpoint() for stateful component requests.
componentsPath 'components/' Directory relative to site/templates/ scanned or resolved for Component classes and views.
uiPath 'ui/' Directory relative to site/templates/ for stateless Ui classes and templates.
allowComponentPaths false Allows dynamic class path resolution from componentsPath when true. Keep false in production and register components explicitly with registerComponent().
loadFrontendAssets true Automatically injects the bundled HTMX 4 client script on frontend pages.
loadHyperscript false Automatically injects the bundled Hyperscript runtime alongside HTMX 4.
autoFlashMessages true Automatically attaches ProcessWire session notices to HTMX responses.
autoExtractTargets false Extracts only the requested HX-Target element when intercepting full-page renders.
tracySupport true Enables HtmxTracyPanel and diagnostic X-PW-HTMX-* headers when TracyDebugger is active in debug mode.
cacheEnabled true Enables HtmxCache shape compilation, component schema caching, and render caching under site/assets/cache/Htmx/.
cacheMaxShapesPerClass 64 Maximum distinct compiled UI shapes cached per Ui class before eviction.
extensions [] Array of bundled HTMX 4 extension names to load globally (out of 16 available extensions).

Next steps