nazg/http-executor

HTTP 组件和响应输出

0.12.1 2020-07-02 23:56 UTC

This package is auto-updated.

Last update: 2024-08-29 05:12:33 UTC


README

Build Status

此库提供以下工具:

灵感来自 zend-httphandlerrunner

要求

HHVM 4.41.0 及以上版本。

安装

$ composer require nazg-hack/http-executor

用法

use type Ytake\Hungrr\ServerRequestFactory;
use type Nazg\HttpExecutor\RequestHandleExecutor;
use type Nazg\HttpExecutor\Emitter\SapiEmitter;
use namespace HH\Lib\IO;

<<__EntryPoint>>
function main(): noreturn {
  list($readHandle, $writeHandle) = IO\pipe_nd();
  $executor = new RequestHandleExecutor(
    $readHandle,
    $writeHandle,
    new ExampleRequestHandler(),
    new SapiEmitter(),
    ServerRequestFactory::fromGlobals()
  );
  $executor->run();
}