bileto/http
最新稳定版本:v0.4.1
Composer 安装命令:
composer require bileto/http
包简介
Library for building an evented http server.
关键字:
README 文档
README
Library for building an evented http server.
This component builds on top of the Socket component to implement HTTP. Here
are the main concepts:
- Server: Attaches itself to an instance of
React\Socket\ServerInterface, parses any incoming data as HTTP, emits arequestevent for each request. - Request: A
ReadableStreamwhich streams the request body and contains meta data which was parsed from the request header. - Response A
WritableStreamwhich streams the response body. You can set the status code and response headers via thewriteHead()method.
Usage
This is an HTTP server which responds with Hello World to every request.
$loop = React\EventLoop\Factory::create(); $socket = new React\Socket\Server($loop); $http = new React\Http\Server($socket); $http->on('request', function ($request, $response) { $response->writeHead(200, array('Content-Type' => 'text/plain')); $response->end("Hello World!\n"); }); $socket->listen(1337); $loop->run();
统计信息
- 总下载量: 17.25k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-21