<?php
use Laminas\Http\Request;
use Laminas\Http\Response;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Laminas\Psr7Bridge\Psr7ServerRequest;
use Laminas\Psr7Bridge\Psr7Response;
$request = new Request();
$request->getQuery()->fromArray([
'foo' => 1,
'bar' => 2,
]);
$psr7Request = Psr7ServerRequest::fromLaminas($request);
dump(
$psr7Request instanceof ServerRequestInterface,
$psr7Request->getMethod(),
$psr7Request->getQueryParams()
);
$response = new Response();
$response->setContent('hello world');
$psr7Response = Psr7Response::fromLaminas($response);
dump(
$psr7Response instanceof ResponseInterface,
$psr7Response->getStatusCode(),
(string) $psr7Response->getBody()
);
^ true
^ "GET"
^ array:2 [
"foo" => 1
"bar" => 2
]
^ true
^ 200
^ "hello world"