runtime/roadrunner-nyholm

带有 nyholm/psr7 的 Roadrunner 运行时

支持包维护!
nyholm

0.1.2 2024-01-05 13:28 UTC

This package is auto-updated.

Last update: 2024-09-05 14:58:27 UTC


README

RoadRunner 提供运行时。

如果您是 Symfony 运行时组件的新手,请阅读 主README 了解更多。

安装

composer require runtime/roadrunner-nyholm

使用方法

为您的应用程序定义环境变量 APP_RUNTIME

APP_RUNTIME=Runtime\RoadRunnerNyholm\Runtime

PSR-7

// public/index.php

use Psr\Http\Message\ServerRequestInterface;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function () {
    return function (ServerRequestInterface $request) {
        return new \Nyholm\Psr7\Response(200, [], 'Hello PSR-7');
    };
};

PSR-15

// public/index.php

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

class Application implements RequestHandlerInterface {
    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        return new \Nyholm\Psr7\Response(200, [], 'Hello PSR-15');
    }
}

return function () {
    return new Application();
};