An existing BEAR.Sunday application can work as a PSR-7 middleware with these easy steps:
bear/middleware package then replace bootstrap.php script.
composer require bear/middleware
cp vendor/bear/middleware/bootstrap/bootstrap.php bootstrap/bootstrap.php
__PACKAGE__\__VENDOR__ in bootstrap.php to application namespace.
Stat the server.
php -S 127.0.0.1:8080 -t public
BEAR.Sunday supports HTTP body of a message output in a stream.
ResourceObject, you can mix stream with a normal string. The output is converted to a single stream.
StreamTransfer is the default HTTP transfer. Seem more at Stream Response.
You can also create a BEAR.Sunday PSR-7 project with
bear/project from scratch.
composer create-project bear/project my-psr7-project cd my-psr7-project/ php -S 127.0.0.1:8080 -t public