xp-forge / htmx

HTMX for XP web frontends

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTMX for XP web frontends

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.4+ Supports PHP 8.0+ Latest Stable Version

HTMX Integration

Authentication

Wrap any authentication flow in a HtmxFlow to ensure authentication does not redirect but instead yields an error code and triggers an event:

+ use web\frontend\HtmxFlow;

- $auth= new SessionBased($flow, $sessions);
+ $auth= new SessionBased(new HtmxFlow($flow), $sessions);

Handle this inside JavaScript with something along the lines of the following:

window.addEventListener('authenticationexpired', e => {
  if (confirm('Authentication expired. Do you want to re-authenticate?')) {
    window.location.reload();
  }
});

About

HTMX for XP web frontends


Languages

Language:PHP 100.0%