nazg / http-executor
HTTP Component and Emit Responses
Installs: 6 050
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Language:Hack
Requires
- hhvm: ^4.62
- facebook/hack-http-request-response-interfaces: ^0.3
- hhvm/hhvm-autoload: ^3.0
- hhvm/hsl: ^4.0
- hhvm/hsl-experimental: ^4.37
- nazg/http-server-request-handler: ^0.6
Requires (Dev)
- facebook/fbexpect: ^2.7
- hhvm/hacktest: ^2.0
- hhvm/hhast: ^4.0
- ytake/hungrr: ^0.13
README
This library provides utilities for:
- Emitting Hack HTTP Request and Response Interfaces responses.
- Running Hack HTTP Server Request Handlers server request handlers, which involves marshaling a Hack HTTP Request and Response Interfaces ServerRequestInterface, handling exceptions due to request creation, and emitting the response returned by the composed request handler.
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(); }