library server-request-handler
Common interfaces for PSR-7 server request handlers
cormy/server-request-handler
Common interfaces for PSR-7 server request handlers
- Tuesday, November 22, 2016
- by schnittstabil
- Repository
- 1 Watchers
- 0 Stars
- 148 Installations
- PHP
- 5 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
Cormy\Server\RequestHandlerInterface
, (*1)
:nut_and_bolt: Common interfaces for PSR-7 server request handlers, (*2)
Install
composer require cormy/server-request-handler
Usage
The following snippet utilizes zend-diactoros:, (*3)
composer require zendframework/zend-diactoros
use Cormy\Server\RequestHandlerInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
class RequestHandler implements RequestHandlerInterface
{
/**
* Process an incoming server request and return the response.
*
* @param ServerRequestInterface $request
*
* @return ResponseInterface
*/
public function __invoke(ServerRequestInterface $request):ResponseInterface
{
$response = new Response();
$response = $response->withHeader('content-type', 'application/json; charset=utf-8');
// ...
return $response;
}
}
License
MIT © Michael Mayer, (*4)
dev-master
9999999-dev
Common interfaces for PSR-7 server request handlers
Sources
Download
MIT
The Requires
The Development Requires
psr
psr-7
http
request
response
handler
http-message
cormy
0.1.0
0.1.0.0
Common interfaces for PSR-7 server request handlers
Sources
Download
MIT
The Requires
The Development Requires
psr
psr-7
http
request
response
handler
http-message
cormy