PHP code example of eonx-com / easy-psr7-factory

1. Go to this page and download the library: Download eonx-com/easy-psr7-factory 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/ */

    

eonx-com / easy-psr7-factory example snippets


use EonX\EasyPsr7Factory\EasyPsr7Factory;

 // Gives you a \Psr\Http\Message\ServerRequestInterface based on all values from the $symfonyRequest
$serverRequest = (new EasyPsr7Factory())->createRequest($symfonyRequest);

// Gives you a \Symfony\Component\HttpFoundation\Response based on all values from the $psr7Response
$symfonyResponse = (new EasyPsr7Factory())->createResponse($psr7Response);

// config/app.php

'providers' => [
    // Other Service Providers...
    
    \EonX\EasyPsr7Factory\Bridge\Laravel\EasyPsr7FactoryServiceProvider::class,
],

// bootstrap/app.php

$app->register(\EonX\EasyPsr7Factory\Bridge\Laravel\EasyPsr7FactoryServiceProvider::class);