Skip to content

Commit a8b9f19

Browse files
authored
Merge pull request #449 from clue-labs/http-example
Update HTTP server example for reactphp/http v1.6.0
2 parents 1967584 + db19ce4 commit a8b9f19

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ client/server and interaction with processes. Third-party libraries can use thes
2323
components to create async network clients/servers and more.
2424

2525
```php
26-
$server = new React\Http\Server(function (Psr\Http\Message\ServerRequestInterface $request) {
27-
return new React\Http\Message\Response(
28-
200,
29-
array(
30-
'Content-Type' => 'text/plain'
31-
),
26+
$server = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
27+
return React\Http\Message\Response::plaintext(
3228
"Hello World!\n"
3329
);
3430
});
3531

36-
$socket = new React\Socket\Server('127.0.0.1:8080');
32+
$socket = new React\Socket\SocketServer('127.0.0.1:8080');
3733
$server->listen($socket);
3834

3935
echo "Server running at http://127.0.0.1:8080" . PHP_EOL;

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"react/cache": "^1.0",
1313
"react/dns": "^1.8",
1414
"react/event-loop": "^1.2",
15-
"react/http": "^1.4",
15+
"react/http": "^1.6",
1616
"react/promise": "^2.1 || ^1.2",
1717
"react/promise-stream": "^1.1.1",
1818
"react/promise-timer": "^1.7",
19-
"react/socket": "^1.8",
19+
"react/socket": "^1.9",
2020
"react/stream": "^1.2"
2121
},
2222
"require-dev": {

phpunit.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<directory>./vendor/react/*/tests/</directory>
77
<!-- temporarily skip broken und unneeded tests, see https://github.com/reactphp/event-loop/pull/232 -->
88
<exclude>./vendor/react/event-loop/tests/BinTest.php</exclude>
9+
<!-- temporarily skip broken und unneeded tests, see https://github.com/reactphp/http/pull/440 -->
10+
<exclude>./vendor/react/http/tests/HttpServerTest.php</exclude>
911
</testsuite>
1012
</testsuites>
1113

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy