Overview

Namespaces

  • PHPFastCGI
    • FastCGIDaemon
      • Command
      • Connection
      • ConnectionHandler
      • Exception
      • Http

Classes

  • PHPFastCGI\FastCGIDaemon\ApplicationFactory
  • PHPFastCGI\FastCGIDaemon\CallbackWrapper
  • PHPFastCGI\FastCGIDaemon\Command\DaemonRunCommand
  • PHPFastCGI\FastCGIDaemon\Connection\StreamSocketConnection
  • PHPFastCGI\FastCGIDaemon\Connection\StreamSocketConnectionPool
  • PHPFastCGI\FastCGIDaemon\ConnectionHandler\ConnectionHandler
  • PHPFastCGI\FastCGIDaemon\ConnectionHandler\ConnectionHandlerFactory
  • PHPFastCGI\FastCGIDaemon\Daemon
  • PHPFastCGI\FastCGIDaemon\DaemonFactory
  • PHPFastCGI\FastCGIDaemon\Http\Request

Interfaces

  • PHPFastCGI\FastCGIDaemon\ApplicationFactoryInterface
  • PHPFastCGI\FastCGIDaemon\Connection\ConnectionInterface
  • PHPFastCGI\FastCGIDaemon\Connection\ConnectionPoolInterface
  • PHPFastCGI\FastCGIDaemon\ConnectionHandler\ConnectionHandlerFactoryInterface
  • PHPFastCGI\FastCGIDaemon\ConnectionHandler\ConnectionHandlerInterface
  • PHPFastCGI\FastCGIDaemon\DaemonFactoryInterface
  • PHPFastCGI\FastCGIDaemon\DaemonInterface
  • PHPFastCGI\FastCGIDaemon\Http\RequestInterface
  • PHPFastCGI\FastCGIDaemon\KernelInterface

Exceptions

  • PHPFastCGI\FastCGIDaemon\Exception\ConnectionException
  • PHPFastCGI\FastCGIDaemon\Exception\DaemonException
  • PHPFastCGI\FastCGIDaemon\Exception\ProtocolException
  • PHPFastCGI\FastCGIDaemon\Exception\ShutdownException
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace PHPFastCGI\FastCGIDaemon;
 4: 
 5: use PHPFastCGI\FastCGIDaemon\Connection\StreamSocketConnectionPool;
 6: use PHPFastCGI\FastCGIDaemon\ConnectionHandler\ConnectionHandlerFactory;
 7: 
 8: /**
 9:  * The default implementation of the DaemonFactoryInterface.
10:  */
11: class DaemonFactory implements DaemonFactoryInterface
12: {
13:     /**
14:      * {@inheritdoc}
15:      *
16:      * @codeCoverageIgnore
17:      */
18:     public function createDaemon($kernel)
19:     {
20:         $socket = fopen('php://fd/'.DaemonInterface::FCGI_LISTENSOCK_FILENO, 'r');
21: 
22:         if (false === $socket) {
23:             throw new \RuntimeException('Could not open FCGI_LISTENSOCK_FILENO');
24:         }
25: 
26:         return $this->createDaemonFromStreamSocket($kernel, $socket);
27:     }
28: 
29:     /**
30:      * {@inheritdoc}
31:      *
32:      * @codeCoverageIgnore
33:      */
34:     public function createTcpDaemon($kernel, $port, $host = 'localhost')
35:     {
36:         $address = 'tcp://'.$host.':'.$port;
37:         $socket  = stream_socket_server($address);
38: 
39:         if (false === $socket) {
40:             throw new \RuntimeException('Could not create stream socket server on: '.$address);
41:         }
42: 
43:         return $this->createDaemonFromStreamSocket($kernel, $socket);
44:     }
45: 
46:     /**
47:      * {@inheritdoc}
48:      */
49:     public function createDaemonFromStreamSocket($kernel, $socket)
50:     {
51:         $connectionHandlerFactory = new ConnectionHandlerFactory($kernel);
52:         $connectionPool           = new StreamSocketConnectionPool($socket);
53: 
54:         return new Daemon($connectionPool, $connectionHandlerFactory);
55:     }
56: }
57: 
API documentation generated by ApiGen