https://github.com/xp-forge/htmx
HTMX for XP web frontends
https://github.com/xp-forge/htmx
authentication htmx php7 php8 xp-framework
Last synced: 7 months ago
JSON representation
HTMX for XP web frontends
- Host: GitHub
- URL: https://github.com/xp-forge/htmx
- Owner: xp-forge
- Created: 2024-01-28T20:20:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-03T12:40:22.000Z (over 1 year ago)
- Last Synced: 2025-02-03T13:38:49.822Z (over 1 year ago)
- Topics: authentication, htmx, php7, php8, xp-framework
- Language: PHP
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
Awesome Lists containing this project
README
HTMX for XP web frontends
=========================
[](https://github.com/xp-forge/htmx/actions)
[](https://github.com/xp-framework/core)
[](https://github.com/xp-framework/core/blob/master/LICENCE.md)
[](http://php.net/)
[](http://php.net/)
[](https://packagist.org/packages/xp-forge/htmx)
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:
```diff
+ 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:
```javascript
window.addEventListener('authenticationexpired', e => {
if (confirm('Authentication expired. Do you want to re-authenticate?')) {
window.location.reload();
}
});
````