Skip to content

This package convert codeigniter4-http object from and to objects implementing HTTP message interfaces defined by PSR-7.

License

Notifications You must be signed in to change notification settings

mumtazhaqiqy/ci4-psr7-http-messages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI4 PSR-7 HTTP Messages

This package convert codeigniter4-http object from and to objects implementing HTTP message interfaces defined by PSR-7.

Instalation

$ composer require mumtazhaqiqy/ci4-psr7-http-messages

$ composer require nyholm/psr7

Usage

The bridge provides an interface of a factory called MumtazHaqiqy\Codeigniter4Psr7\Interfaces\HttpPsr7FactoryInterface that builds objects implementing PSR-7 interfaces from IncommingRequest objects.

The following code snippet explains how to convert a CodeIgniter\HTTP\IncomingRequest to a Nyholm\Psr7\ServerRequest class implementing the Psr\Http\Message\ServerRequestInterface interface:

<?php

use CodeIgniter\Config\Services;
use MumtazHaqiqy\Codeigniter4Psr7\HttpPsr7Factory;
use Nyholm\Psr7\Factory\Psr17Factory;

$requestCodeIgniter = Services::request();

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

About

This package convert codeigniter4-http object from and to objects implementing HTTP message interfaces defined by PSR-7.

Topics

Resources

License

Stars

Watchers

Forks

Languages