PHP 클래스 Phly\Http\Server

Given a callback, takes an incoming request, dispatches it to the callback, and then sends a response.
파일 보기 프로젝트 열기: phly/http 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( callable $callback, Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response ) Constructor
__get ( string $name ) : mixed Allow retrieving the request, response and callback as properties
createServer ( callable $callback, array $server, array $query, array $body, array $cookies, array $files ) : static Create a Server instance
createServerFromRequest ( callable $callback, Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response = null ) : static Create a Server instance from an existing request object
listen ( callable $finalHandler = null ) "Listen" to an incoming request
setEmitter ( Phly\Http\Response\EmitterInterface $emitter ) Set alternate response emitter to use.

비공개 메소드들

메소드 설명
getEmitter ( ) : Phly\Http\Response\EmitterInterface Retrieve the current response emitter.

메소드 상세

__construct() 공개 메소드

Given a callback, a request, and a response, we can create a server.
public __construct ( callable $callback, Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response )
$callback callable
$request Psr\Http\Message\ServerRequestInterface
$response Psr\Http\Message\ResponseInterface

__get() 공개 메소드

Allow retrieving the request, response and callback as properties
public __get ( string $name ) : mixed
$name string
리턴 mixed

createServer() 공개 정적인 메소드

Creates a server instance from the callback and the following PHP environmental values: - server; typically this will be the $_SERVER superglobal - query; typically this will be the $_GET superglobal - body; typically this will be the $_POST superglobal - cookies; typically this will be the $_COOKIE superglobal - files; typically this will be the $_FILES superglobal
public static createServer ( callable $callback, array $server, array $query, array $body, array $cookies, array $files ) : static
$callback callable
$server array
$query array
$body array
$cookies array
$files array
리턴 static

createServerFromRequest() 공개 정적인 메소드

Provided a callback, an existing request object, and optionally an existing response object, create and return the Server instance. If no Response object is provided, one will be created.
public static createServerFromRequest ( callable $callback, Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response = null ) : static
$callback callable
$request Psr\Http\Message\ServerRequestInterface
$response Psr\Http\Message\ResponseInterface
리턴 static

listen() 공개 메소드

If provided a $finalHandler, that callable will be used for incomplete requests. Output buffering is enabled prior to invoking the attached callback; any output buffered will be sent prior to any response body content.
public listen ( callable $finalHandler = null )
$finalHandler callable

setEmitter() 공개 메소드

Set alternate response emitter to use.
public setEmitter ( Phly\Http\Response\EmitterInterface $emitter )
$emitter Phly\Http\Response\EmitterInterface