PHP code example of h4cc / stack-psr7-bridge

1. Go to this page and download the library: Download h4cc/stack-psr7-bridge library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

h4cc / stack-psr7-bridge example snippets




$bridge = new Psr7Bridge($yourHttpKernel);

// Handling PSR-7 requests
$psr7Response = $bridge->__invoke($psr7Request, $psr7Response);

// Handling Symfony requests
$symfonyResponse = $bridge->_handle($symfonyRequest);



$psr7Callback = function(RequestInterface $request, ResponseInterface $response, $next = null) {
  // Creating a PSR-7 Response here ...
};

$bridge = new Psr7Bridge($psr7Callback);

// Handling PSR-7 requests
$psr7Response = $bridge->__invoke($psr7Request, $psr7Response);

// Handling Symfony requests
$symfonyResponse = $bridge->_handle($symfonyRequest);