Skip to content

Why Htmx?

Adding a <script src="htmx.min.js"> tag to a ProcessWire template is easy, but real production hypermedia apps quickly run into recurring plumbing problems: CSRF validation on mutations, tamper-proof component state across swaps, avoiding hx-on attribute injection, multi-target partial responses, and keeping PHP template rendering fast under load.

Capability Manual HTMX + URL Hooks ProcessWire Htmx Module
Endpoint routing & dispatch Manual URL hooks per action, duplicated parsing Single unified endpointUrl (/hx/req) dispatching to registered Component classes
Component state security Hidden inputs or unsigned query params easily tampered SignedStateCodec (HKDF-SHA256) bound to user ID, session, endpoint, page ID, and admin context
Action CSRF & RBAC Easy to forget $session->CSRF->validate() on one route Automatic CSRF verification on all mutating HTTP verbs (POST/PUT/PATCH/DELETE), plus authorize() and authorizeAction()
Read-only vs. mutating actions Mixed conventions across templates Explicit query* read-only GET/QUERY actions vs. CSRF-protected mutating actions
Reusable UI primitives Repetitive PHP partials with manual if (!empty(...)) checks Stateless Ui with named Zones, Slots, Value Gates, XSS-safe AttributeBag, and HtmxCache shape compilation
Multi-target swaps & headers Raw header() calls and concatenated HTML strings Typed Request, Response, and Fragment APIs with <hx-partial>, deferred HX-Trigger, and HTTP 286 polling stop
  • Choose Htmx when your pages are server-rendered ProcessWire templates that need live filtering, pagination, inline forms, modals, or progressive enhancement without a Node/TypeScript build pipeline.
  • Choose Inertia + React when you need rich client-side state machines, drag-and-drop visual builders, or full SPA navigation with shared workspace shells.
  • Use both together: Htmx is completely standalone and does not conflict with Vite, Inertia, or React.

Next steps