Skip to main content

Engine

Normally PHP apps are served through classical web servers like Apache or Nginx but there are currently also other ways to run your app. We are very interested in those approaches and with PSX we have implemented an engine system to support different runtimes. If we take a look at our index.php file:

<?php

require_once(__DIR__ . '/../vendor/autoload.php');

$container = require_once(__DIR__ . '/../container.php');

$engine = new \PSX\Engine\WebServer\Engine($container->getParameter('psx_url'));
$dispatcher = $container->get(\PSX\Engine\DispatchInterface::class);
$environment = new \PSX\Framework\Environment\Environment($dispatcher, $engine);

return $environment->serve();

The $engine variable defines the engine which is used, by default we use a classical web server. If you want to use a different web server like Amp, Swoole or RoadRunner you can use a specific engine. The following engines are available:

  • Apache/NGINX

    Classical web server like Apache or NGINX which uses either FCGI or includes PHP as module (Apache). This engine is included by default.

    • Class: PSX\Engine\WebServer\Engine
  • Amp

    HTTP server completely written in PHP

  • Swoole

    HTTP server written as PHP extension in C/C++

  • Roadrunner

    HTTP server written in GO