Download the PHP package tomrf/htmx-message without Composer
On this page you can find all versions of the php package tomrf/htmx-message. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tomrf/htmx-message
More information about tomrf/htmx-message
Files in tomrf/htmx-message
Package htmx-message
Short Description PHP PSR-7 proxy classes with convenience methods for htmx requests and responses
License MIT
Homepage http://github.com/tomrf/htmx-message
Informations about the package htmx-message
htmx-message - PHP PSR-7 proxy classes with convenience methods for htmx requests and responses
PSR-7 ServerRequestInterface
and ResponseInterface
proxy classes for htmx
with convenience methods for all special htmx headers (HX-*
) in request and
response objects.
HtmxResponse
is a proxy for PSR-7 response objects implementing \Psr\Http\Message\ResponseInterface
.
HtmxServerRequest
is a proxy for PSR-7 server request objects implementing \Psr\Http\Message\ServerRequestInterface
.
You can safely wrap any ResponseInterface
or ServerRequestInterface
object, also those not originating from htmx
, without affecting your application.
HtmxResponse
and HtmxServerRequest
objects retains immutability in the same fashion as one would expect from a PSR-7 MessageInterface
, returning a new object wrapping a new ResponseInterface
instance whenever the HtmxResponse
is changed.
Conforms to htmx
version 1.9.x (latest) as per 2023-08-01.
📔 Go to documentation
Installation
Installation via composer:
Usage
Testing
License
This project is released under the MIT License (MIT). See LICENSE for more information.
Documentation
- Tomrf\HtmxMessage\HtmxResponse
- getHxPush
- getHxRedirect
- getHxRetarget
- getHxTrigger
- getHxTriggerAfterSettle
- getHxTriggerAfterSwap
- hasHxPush
- hasHxRedirect
- hasHxRefresh
- hasHxRetarget
- hasHxTrigger
- hasHxTriggerAfterSettle
- hasHxTriggerAfterSwap
- withAddedHxTrigger
- withAddedHxTriggerAfterSettle
- withAddedHxTriggerAfterSwap
- withHxPush
- withHxRedirect
- withHxRefresh
- withHxRetarget
- withHxTrigger
- withHxTriggerAfterSettle
- withHxTriggerAfterSwap
- withoutHxPush
- withoutHxRedirect
- withoutHxRefresh
- withoutHxRetarget
- withoutHxTrigger
- withoutHxTriggerAfterSettle
- withoutHxTriggerAfterSwap
- Tomrf\HtmxMessage\HtmxServerRequest
- getHxCurrentUrl
- getHxPrompt
- getHxTarget
- getHxTrigger
- getHxTriggerName
- hasHxPrompt
- hasHxTarget
- hasHxTrigger
- hasHxTriggerName
- isHxBoosted
- isHxHistoryRestoreRequest
- isHxRequest
- __construct
📂 Tomrf\HtmxMessage\HtmxResponse::class
HtmxResponse is a proxy for PSR-7 response objects implementing \Psr\Http\Message\ResponseInterface.
You can safely wrap any ResponseInterface object, also those not responding to a htmx request, without affecting your application.
HtmxResponse objects retains immutability in the same fashion as one would expect from a PSR-7 MessageInterface, returning a new object wrapping a new ResponseInterface instance whenever the HtmxResponse is changed.
Example:
$response = new HtmxResponse($response);
$response = $response->withHxTrigger('myTrigger')
->withRedirect('/user/redirected')
->withHxPush(false);
// ...
getHxPush()
getHxRedirect()
getHxRetarget()
getHxTrigger()
getHxTriggerAfterSettle()
getHxTriggerAfterSwap()
hasHxPush()
hasHxRedirect()
hasHxRefresh()
hasHxRetarget()
hasHxTrigger()
hasHxTriggerAfterSettle()
hasHxTriggerAfterSwap()
withAddedHxTrigger()
withAddedHxTriggerAfterSettle()
withAddedHxTriggerAfterSwap()
withHxPush()
withHxRedirect()
withHxRefresh()
withHxRetarget()
withHxTrigger()
withHxTriggerAfterSettle()
withHxTriggerAfterSwap()
withoutHxPush()
withoutHxRedirect()
withoutHxRefresh()
withoutHxRetarget()
withoutHxTrigger()
withoutHxTriggerAfterSettle()
withoutHxTriggerAfterSwap()
📂 Tomrf\HtmxMessage\HtmxServerRequest::class
HtmxServerRequest is a proxy for PSR-7 server request objects implementing \Psr\Http\Message\ServerRequestInterface.
You can safely wrap any ServerRequestInterface object, also those not originating from htmx, without affecting your application.
Check if the request originated from htmx using the isHxRequest() method.
HtmxServerRequest objects retains immutability in the same fashion as one would expect from a PSR-7 MessageInterface, returning a new object wrapping a new ServerRequestInterface instance whenever the HtmxServerRequest is changed.
Example:
$request = new HtmxServerRequest($request);
if ($request->isHxRequest() && $request->isHxBoosted()) {
// htmx request from boosted client, respond accordingly
}
$userPrompt = $request->getHxPrompt();
// ...
getHxCurrentUrl()
getHxPrompt()
getHxTarget()
getHxTrigger()
getHxTriggerName()
hasHxPrompt()
hasHxTarget()
hasHxTrigger()
hasHxTriggerName()
isHxBoosted()
isHxHistoryRestoreRequest()
isHxRequest()
__construct()
Generated 2023-08-18T12:46:49+00:00 using 📚tomrf/readme-gen