Skip to content

Repository files navigation

PSR-7 and PSR-15 Runtime

A runtime with guzzlehttp/psr7.

If you are new to the Symfony Runtime component, read more in the main readme.

Installation

composer require runtime/psr-guzzle

Usage

This runtime is discovered automatically. You can force your application to use this runtime by defining the environment variable APP_RUNTIME.

APP_RUNTIME=Runtime\PsrGuzzle\Runtime

PSR-7

// public/index.phpusePsr\Http\Message\ServerRequestInterface;
useGuzzleHttp\Psr7;
require_oncedirname(__DIR__).'/vendor/autoload_runtime.php';
returnfunction (ServerRequestInterface$request) {
returnnewPsr7\Response(200, [], 'PSR-7');
};

PSR-15

// public/index.phpusePsr\Http\Server\RequestHandlerInterface;
usePsr\Http\Message\ServerRequestInterface;
usePsr\Http\Message\ResponseInterface;
useGuzzleHttp\Psr7;
require_oncedirname(__DIR__).'/vendor/autoload_runtime.php';
class Application implements RequestHandlerInterface {
// ...publicfunctionhandle(ServerRequestInterface$request): ResponseInterface
{
returnnewPsr7\Response(200, [], 'PSR-15');
}
}
returnfunction (array$context) {
returnnewApplication($context['APP_ENV'] ?? 'dev');
};

About

[READ ONLY]

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages