Skip to content

Commit

Permalink
Merge pull request #449 from clue-labs/http-example
Browse files Browse the repository at this point in the history
Update HTTP server example for reactphp/http v1.6.0
  • Loading branch information
WyriHaximus committed Feb 5, 2022
2 parents 1967584 + db19ce4 commit a8b9f19
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
10 changes: 3 additions & 7 deletions README.md
Expand Up @@ -23,17 +23,13 @@ client/server and interaction with processes. Third-party libraries can use thes
components to create async network clients/servers and more.

```php
$server = new React\Http\Server(function (Psr\Http\Message\ServerRequestInterface $request) {
return new React\Http\Message\Response(
200,
array(
'Content-Type' => 'text/plain'
),
$server = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
return React\Http\Message\Response::plaintext(
"Hello World!\n"
);
});

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

echo "Server running at http://127.0.0.1:8080" . PHP_EOL;
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -12,11 +12,11 @@
"react/cache": "^1.0",
"react/dns": "^1.8",
"react/event-loop": "^1.2",
"react/http": "^1.4",
"react/http": "^1.6",
"react/promise": "^2.1 || ^1.2",
"react/promise-stream": "^1.1.1",
"react/promise-timer": "^1.7",
"react/socket": "^1.8",
"react/socket": "^1.9",
"react/stream": "^1.2"
},
"require-dev": {
Expand Down
2 changes: 2 additions & 0 deletions phpunit.xml.dist
Expand Up @@ -6,6 +6,8 @@
<directory>./vendor/react/*/tests/</directory>
<!-- temporarily skip broken und unneeded tests, see https://github.com/reactphp/event-loop/pull/232 -->
<exclude>./vendor/react/event-loop/tests/BinTest.php</exclude>
<!-- temporarily skip broken und unneeded tests, see https://github.com/reactphp/http/pull/440 -->
<exclude>./vendor/react/http/tests/HttpServerTest.php</exclude>
</testsuite>
</testsuites>

Expand Down

0 comments on commit a8b9f19

Please sign in to comment.