Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 1.62 KB

README.md

File metadata and controls

39 lines (24 loc) · 1.62 KB

HMS fork of thecodingmachine/symfony-httpinterop-bridge

Bridges between Symfony HttpKernel and HTTP Message Strategies (PSR pre-Draft)

Those adapters are built on top of the existing symfony/psr-http-message-bridge that bridges Symfony and PSR-7 HTTP messages.

This bridge is currently based on Common interfaces for HTTP Message Strategies. As this is in an early stage, this might be subject to change!

Usage

By default, the Symfony HttpFoundation and HttpKernel are used. For PSR-7, the Zend-Diactoros implementation is used. These implementations can be changed if needed.

Wrapping a HttpKernel

// Use the HttpInteropToSymfonyBridge adapter
$requestHandlerStrategy = new HttpInteropToSymfonyBridge($yourHttpKernel);

// Handling PSR-7 requests
$psr7Response = $requestHandlerStrategy($psr7Request);

Wrapping a PSR-7 callback

// Use the SymfonyToHttpInteropBridge adapter
$symfonyKernel = new SymfonyToHttpInteropBridge($yourServerRequestHandler);

// Handling Symfony requests
$symfonyResponse = $symfonyKernel->handle($symfonyRequest);

Related