Skip to content

nazg-hack/http-executor

Repository files navigation

Nazg\HttpExecutor

Build Status

This library provides utilities for:

Inspired by zend-httphandlerrunner

Require

HHVM 4.41.0 and above.

Installation

$ composer require nazg-hack/http-executor

Usage

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();
}