Zend\Diactoros\Server::createServer PHP Method

createServer() public static method

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
return static
    public static function createServer(callable $callback, array $server, array $query, array $body, array $cookies, array $files)
    {
        $request = ServerRequestFactory::fromGlobals($server, $query, $body, $cookies, $files);
        $response = new Response();
        return new static($callback, $request, $response);
    }

Usage Example

Example #1
0
 public function listen()
 {
     $app = $this->getApp();
     $this->collectGarbage($app);
     $server = Server::createServer($this->getMiddleware($app), $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
     $server->listen();
 }
All Usage Examples Of Zend\Diactoros\Server::createServer