webware / webware-htmx
Provides HTMX support via laminas-view to webware applications.
Requires
- php: ~8.4.1 || ~8.5.0
- laminas/laminas-diactoros: ^3.8
- laminas/laminas-view: ^3.0
- mezzio/mezzio: ^3.26
- mezzio/mezzio-laminasviewrenderer: ^3.0
- mezzio/mezzio-template: ^2.8 || ^3.0
- psr/container: ^2.0
- psr/http-message: ^2.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- infection/infection: ^0.35.0
- laminas/laminas-config-aggregator: ^1.19
- laminas/laminas-servicemanager: ^4.5
- phpbench/phpbench: ^1.7
- phpunit/phpunit: ^13.3
- roave/backward-compatibility-check: ^8.21.0
- roave/security-advisories: dev-master
- webware/webware-tools: ^1.0.0-beta.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-03 15:43:35 UTC
README
Provides HTMX support via laminas-view to webware applications: AJAX request detection middleware, HTMX response headers and triggers, and a body-aware laminas-view renderer.
Installation
composer require webware/webware-htmx
Register the ConfigProvider in your Mezzio application config aggregator:
Webware\Htmx\ConfigProvider::class,
What it provides
DetectAjaxRequestMiddleware— detects HTMX requests and filters the incoming server request.DisableBodyMiddleware— disables the body layer for HTMX requests.Webware\Htmx\Response\Header— HTMX response header helpers (HX-Trigger,HX-Redirect, …).Webware\Htmx\View\LaminasRenderer— a laminas-view renderer with body/layout layering, registered as the defaultTemplateRendererInterface.- A baseline body template at
templates/default/body/default.phtml, published asbody::default.
Configuration
Two keys, one value each, and both values name template addresses rather than paths:
| Key | Meaning |
|---|---|
templates.body |
the address of the body layer, e.g. body::default |
templates.layout |
the address of the layout, e.g. layout::default |
Neither is required: with no templates.body the content renders alone, and with no templates.layout
nothing wraps it.
The package publishes body::default for its own baseline template in templates.map. Overriding it needs
no special placement: a map's key is the address, string keys merge later-wins, so a provider merged
after this package's — an application's own ConfigProvider, a config file, or a theme — replaces the value
for anyone asking for that address.
With webware/webware-theme installed, both addresses resolve through the theme, so body::default can
point at any theme's file without this package knowing themes exist.