IncomingRequest
Available methods:
- isHtmx()
- isBoosted()
- isHistoryRestoreRequest()
- getCurrentUrl()
- getPrompt()
- getTarget()
- getTrigger()
- getTriggerName()
- getTriggeringEvent()
- is()
isHtmx()
Checks if there is a HX-Request
header in place.
Indicates that the request was fired with htmx.
$this->request->isHtmx();
isBoosted()
Checks if there is a HX-Boosted
header in place.
Indicates that the request is via an element using hx-boost
$this->request->isBoosted();
isHistoryRestoreRequest()
Checks if there is a HX-History-Restore-Request
header in place.
True if the request is for history restoration after a miss in the local history cache.
$this->request->isHistoryRestoreRequest();
getCurrentUrl()
Checks the HX-Current-URL
header and return current URL of the browser.
$this->request->getCurrentUrl();
getPrompt()
Checks the HX-Prompt
header - the user response to an hx-prompt.
$this->request->getPrompt();
getTarget()
Checks the HX-Target
header. Returns the id
of the target element if it exists.
$this->request->getTarget();
getTrigger()
Checks the HX-Trigger
header. Returns the id
of the triggered element if it exists.
$this->request->getTrigger();
getTriggerName()
Checks the HX-Trigger-Name
header. Returns the name
of the triggered element if it exists.
$this->request->getTriggerName();
getTriggeringEvent()
Checks the Triggering-Event
header. The value of the header is a JSON serialized version of the event that triggered the request.
Check the event-header plugin for more information.
is()
This new method is available in CodeIgniter since v4.3. It's a handful shortcut and alternative to another CodeIgniter method: getMethod()
. But it also provides different types of checks - you can read more about it in the user guide.
Along with this library, we added two new parameters that can be used: htmx
and boosted
which are equivalent of using isHtmx()
and isBoosted()
methods.
$this->request->is('htmx');
// or
$this->request->is('boosted');