PHPackages                             agungsugiarto/codeigniter4-psr7bridge - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. agungsugiarto/codeigniter4-psr7bridge

ActiveLibrary[HTTP &amp; Networking](/categories/http)

agungsugiarto/codeigniter4-psr7bridge
=====================================

CodeIgniter 4 PSR HTTP message bridge

v1.0.0-beta.2(3y ago)16MITPHPPHP ^7.2

Since Dec 31Pushed 3y ago1 watchersCompare

[ Source](https://github.com/agungsugiarto/codeigniter4-psr7bridge)[ Packagist](https://packagist.org/packages/agungsugiarto/codeigniter4-psr7bridge)[ RSS](/packages/agungsugiarto-codeigniter4-psr7bridge/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

CodeIgniter4 PSR-7 Bridge
=========================

[](#codeigniter4-psr-7-bridge)

[![Latest Stable Version](https://camo.githubusercontent.com/a0e56367568c44ef5b675056ad6d74ba9a05eca9fbff75b59df4b582ef2cf26a/68747470733a2f2f706f7365722e707567782e6f72672f6167756e67737567696172746f2f636f646569676e69746572342d707372376272696467652f76)](https://packagist.org/packages/agungsugiarto/codeigniter4-psr7bridge)[![Total Downloads](https://camo.githubusercontent.com/bd400847ed6e3f3a45db3653daa162f94ddc2d9782283d65a9e3ce6ee786a64d/68747470733a2f2f706f7365722e707567782e6f72672f6167756e67737567696172746f2f636f646569676e69746572342d707372376272696467652f646f776e6c6f616473)](https://packagist.org/packages/agungsugiarto/codeigniter4-psr7bridge)[![Latest Unstable Version](https://camo.githubusercontent.com/32f6de996f1e6f5f9cf00acb50794a8855f066713783aba493dd16418eccc408/68747470733a2f2f706f7365722e707567782e6f72672f6167756e67737567696172746f2f636f646569676e69746572342d707372376272696467652f762f756e737461626c65)](https://packagist.org/packages/agungsugiarto/codeigniter4-psr7bridge)[![License](https://camo.githubusercontent.com/38e17e01df6037912c997bd76b33ace5ec8eb11552ba62f286b1826a9458e371/68747470733a2f2f706f7365722e707567782e6f72672f6167756e67737567696172746f2f636f646569676e69746572342d707372376272696467652f6c6963656e7365)](https://packagist.org/packages/agungsugiarto/codeigniter4-psr7bridge)

The PSR-7 Bridge
----------------

[](#the-psr-7-bridge)

> The PSR-7 bridge converts [codeigniter4-http](https://codeigniter4.github.io/userguide/incoming/message.html)objects from and to objects implementing HTTP message interfaces defined by the [PSR-7](http://www.php-fig.org/psr/psr-7/).

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
    - [Converting from IncomingRequest Objects to PSR-7](#converting-from-incomingrequest-objects-to-psr-7)

Installation
------------

[](#installation)

```
$ composer require agungsugiarto/codeigniter4-psr7bridge
```

The bridge also needs a PSR-7 and [PSR-17](https://www.php-fig.org/psr/psr-17/) implementation to convert `IncomingRequest` objects to PSR-7 objects. The following command installs the `nyholm/psr7` library, a lightweight and fast PSR-7 implementation.

```
$ composer require nyholm/psr7
```

Usage
-----

[](#usage)

### Converting from IncomingRequest Objects to PSR-7

[](#converting-from-incomingrequest-objects-to-psr-7)

The bridge provides an interface of a factory called `Fluent\HttpMessageBridge\Interfaces\HttpMessageFactoryInterface`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:

```
