PHP code example of agungsugiarto / codeigniter4-psr7bridge

1. Go to this page and download the library: Download agungsugiarto/codeigniter4-psr7bridge 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/ */

    

agungsugiarto / codeigniter4-psr7bridge example snippets




use CodeIgniter\Config\Services;
use Fluent\HttpMessageBridge\PsrHttpFactory;
use Nyholm\Psr7\Factory\Psr17Factory;

$requestCodeIgniter = Services::request();

$psr17Factory = new Psr17Factory();
$psrHttpFactory = new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory);
$psrRequest = $psrHttpFactory->createRequest($requestCodeIgniter);



use CodeIgniter\HTTP\Response;
use Fluent\HttpMessageBridge\PsrHttpFactory;
use Nyholm\Psr7\Factory\Psr17Factory;

$responseCodeIgniter = new Response(config('App'));

$psr17Factory = new Psr17Factory();
$psrHttpFactory = new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory);
$psrResponse = $psrHttpFactory->createResponse($responseCodeIgniter);