Laminas Diactoros Server Class Not Found Error

i use Laminas Stratigility 2.2
i tried this example which i get it from

use Laminas\Diactoros\Response;
use Laminas\Diactoros\Server;
use Laminas\Stratigility\Middleware\NotFoundHandler;
use Laminas\Stratigility\MiddlewarePipe;

use function Laminas\Stratigility\middleware;
use function Laminas\Stratigility\path;

require __DIR__ . '/../vendor/autoload.php';

$app = new MiddlewarePipe();

$server = Server::createServer([$app, 'handle'], $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);

But i get an error Class ‘Laminas\Diactoros\Server’ not found

If you use an older version of laminas-stratigility then you should use also the related documentation:

(You can change the version of the documentation in the header next to the search button or look at the URL you posted here.)

Sorry for wrong information.
I use “laminas/laminas-diactoros”: “^2.2”
I tried this example (v3 and v2 are same)
I get this error: Class ‘Laminas\Diactoros\Server’ not found
I check the github repo ( ) but there is no class called “Laminas\Diactoros\Server”

1 Like

We need to update that example; Diactoros removed the Server class with version 2.0.0. You should instead use laminas/laminas-httphandlerrunner to run your middleware application.

I’ve opened laminas/laminas-diactoros#38 so you can track the issue.