PHPackages                             bvdputte/kirby-htmx - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bvdputte/kirby-htmx

ActiveKirby-plugin[Utility &amp; Helpers](/categories/utility)

bvdputte/kirby-htmx
===================

Little helper utility to keep your code DRY when uring HTMX in Kirby

1.0.0(1y ago)562MITPHP

Since Jan 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/bvdputte/kirby-htmx)[ Packagist](https://packagist.org/packages/bvdputte/kirby-htmx)[ RSS](/packages/bvdputte-kirby-htmx/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Kirby HTMX plugin
=================

[](#kirby-htmx-plugin)

Little helper utility to keep your code DRY when using HTMX in Kirby.

Installation
------------

[](#installation)

- unzip [master.zip](https://github.com/bvdputte/kirby-htmx/archive/master.zip) as folder `site/plugins/kirby-htmx` or
- `git submodule add https://github.com/bvdputte/kirby-htmx.git site/plugins/kirby-htmx` or
- `composer require bvdputte/kirby-htmx`

Usage
-----

[](#usage)

1. Make a snippet for each HTMX "*interactive island*".
2. Embed the snippet in your template via Kirby's `snippet()` helper.
3. Use the plugin's `hxHeader()` helper to generate the required hx-data attribute

[HTMX](https://htmx.org) expects the server to reply with hypermedia for HTMX requests.
Inside the snippet, use the `hxHeaders()` helper to add it together with the Hx data attributes on the wrapper element.

On first page load, Kirby will add the snippet as always. For HTMX interaction with the page, Kirby will now respond with only the hypermedia generated from within the snippet.

Example
-------

[](#example)

```
// snippets/test.php
