Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HTTP server example for reactphp/http v1.6.0 #449

Merged
merged 3 commits into from Feb 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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