-
Notifications
You must be signed in to change notification settings - Fork 0
/
composer.json
executable file
·123 lines (123 loc) · 4.43 KB
/
composer.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{
"name": "tomrf/htmx-message",
"type": "library",
"description": "PHP PSR-7 proxy classes with convenience methods for htmx requests and responses",
"keywords": [ "htmx", "http-message", "psr-7", "server-request", "http-request", "http-response" ],
"homepage": "http://github.com/tomrf/htmx-message",
"license": "MIT",
"authors": [
{
"name": "Tom Rune Flo",
"email": "[email protected]",
"homepage": "http://github.com/tomrf/"
}
],
"extra": {
"intro": [
"PSR-7 `ServerRequestInterface` and `ResponseInterface` proxy classes for [`htmx`](https://htmx.org)",
"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`](htmx.org), 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`](https://htmx.org) version 1.9.x (latest) as per 2023-11-10."
],
"example": [
"$request = new HtmxRequest($request); // PSR-7 `ServerRequestInterface`",
"",
"if ($request->isHxRequest() && $request->isHxBoosted()) {",
" $layout = 'ajax.layout';",
"}",
"",
"[...]",
"",
"$response = new HtmxResponse($response); // PSR-7 `ResponseInterface`",
"",
"$response = $response->withHxTrigger('aSimpleTrigger')",
" ->withAddedHxTrigger('triggerWithParams', ['arg' => true, 'arg2' => 7])",
" ->withTriggerAfterSwap('afterSwap', time())",
" ->withHxPush($newUrl);",
"",
"// Emit $response as normal",
"[...]"
]
},
"require": {
"php": "^8.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^10.1",
"phpstan/phpstan": "^1.10",
"friendsofphp/php-cs-fixer": "^3.17",
"phpmd/phpmd": "^2.12",
"bmitch/churn-php": "^1.7",
"roave/security-advisories": "dev-latest",
"nyholm/psr7-server": "^1.0",
"nyholm/psr7": "^1.8",
"tomrf/http-emitter": "^0.0",
"tomrf/readme-gen": "^0.0"
},
"autoload": {
"psr-4": {
"Tomrf\\HtmxMessage\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tomrf\\HtmxMessage\\Test\\": "tests/"
}
},
"scripts": {
"phpunit": [
"phpunit -c .phpunit.dist.xml --colors=auto --no-coverage --stderr"
],
"cs-fixer": [
"php-cs-fixer fix --allow-risky=yes --diff --verbose src/"
],
"phpstan": [
"phpstan analyze --level max src/"
],
"phpmd": [
"phpmd src/ ansi .phpmd-ruleset.xml"
],
"churn": [
"churn run src/ | tail -n +7"
],
"test": [
"@phpunit"
],
"test-coverage": [
"@putenv XDEBUG_MODE=coverage",
"@phpunit --coverage-text"
],
"test-coverage-html": [
"@putenv XDEBUG_MODE=coverage",
"@phpunit --coverage-html .phpunit.cache/code-coverage/html",
"php -S localhost:0 -t .phpunit.cache/code-coverage/html"
],
"test-coverage-xml": [
"@putenv XDEBUG_MODE=coverage",
"@phpunit --coverage-xml .phpunit.cache/code-coverage/xml",
"ls -al .phpunit.cache/code-coverage/xml"
],
"check": [
"@test",
"@phpmd",
"@phpstan",
"@churn"
],
"clean": [
"rm -rf vendor/ .phpunit.cache .php-cs-fixer.cache"
],
"readme-gen": [
"readme-gen ./ ./.readme.template.md"
]
}
}