nazg/http-executor

HTTP Component and Emit Responses

Installs: 5 015

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:Hack

0.12.1 2020-07-02 23:56 UTC

This package is auto-updated.

Last update: 2020-07-03 00:02:19 UTC


README

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