psx/engine

支持多种网络服务器类型的引擎

v2.0.0 2023-03-26 10:10 UTC

This package is auto-updated.

Last update: 2024-08-26 13:01:09 UTC


README

关于

该引擎包提供了多种方式在不同的环境中运行您的PSX应用程序。默认情况下,它使用为类似Apache或Nginx的经典网络服务器设计的网络服务器引擎。但在PHP世界中,有许多替代的网络服务器解决方案,这些解决方案也可以提高您应用程序的性能。

引擎

  • Apache/NGINX

    类似Apache或NGINX的经典网络服务器,使用FCGI或包含PHP模块(Apache)。此引擎默认包含。

    • 类: PSX\Engine\WebServer\Engine
  • Amp

    完全用PHP编写的HTTP服务器

  • Swoole

    用C/C++编写的PHP扩展的HTTP服务器

  • Roadrunner

    用GO编写的HTTP服务器并使用

用法

要使用不同的引擎,只需通过composer安装包。然后您需要调整您的index.php并使用合适的引擎类。

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

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

$engine      = null; # adjust the engine class
$environment = \PSX\Framework\Environment\Environment::fromContainer($container, $engine);

$environment->serve();