xp-forge / htmx
HTMX integration for XP web frontends
Installs: 915
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/xp-forge/htmx
Requires
- php: >=7.4.0
- xp-forge/frontend: ^7.0 | ^6.0 | ^5.0
- xp-forge/web-auth: ^6.1
- xp-framework/core: ^12.0 | ^11.0 | ^10.0
Requires (Dev)
- xp-framework/test: ^2.0 | ^1.0
README
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(); } });