nazg/http-executor

HTTP Component and Emit Responses

Installs: 6 051

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:Hack

0.12.1 2020-07-02 23:56 UTC

This package is auto-updated.

Last update: 2024-10-29 05:40:17 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();
}