PHPackages                             dmt-software/aura-web-psr - 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. [API Development](/categories/api)
4. /
5. dmt-software/aura-web-psr

ActiveLibrary[API Development](/categories/api)

dmt-software/aura-web-psr
=========================

PSR-7 wrapper for Aura.Web implementations

v1.0.0(5y ago)28MITPHPPHP &gt;=7.0

Since Feb 18Pushed 4y ago2 watchersCompare

[ Source](https://github.com/dmt-software/aura-web-psr)[ Packagist](https://packagist.org/packages/dmt-software/aura-web-psr)[ RSS](/packages/dmt-software-aura-web-psr/feed)WikiDiscussions master Synced today

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

Aura Web PSR-7 wrapper
======================

[](#aura-web-psr-7-wrapper)

[![Latest Stable Version](https://camo.githubusercontent.com/d3031235e6d5e13562fcd1cd2a3857af24662dde537d1bc6a44e96de2ad3d561/68747470733a2f2f706f7365722e707567782e6f72672f646d742d736f6674776172652f617572612d7765622d7073722f762f737461626c65)](https://packagist.org/packages/dmt-software/aura-web-psr)[![Build Status](https://camo.githubusercontent.com/d5d68ba397e8e3c3c869702550b8d05315bbf24e6cf1f9a4f1b8f1e23d948596/68747470733a2f2f7472617669732d63692e636f6d2f646d742d736f6674776172652f617572612d7765622d7073722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/dmt-software/aura-web-psr)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/588b472eb57c822bf05e1496fb789d66b522bc2465916c9167cfdb8686f70f18/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f646d742d736f6674776172652f617572612d7765622d7073722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dmt-software/aura-web-psr/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/39ffe36a3fc75f895e86951d6e31441f7976b86255d3353988cef08527678cf6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f646d742d736f6674776172652f617572612d7765622d7073722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dmt-software/aura-web-psr/?branch=master)[![License](https://camo.githubusercontent.com/8bac4de7bac659537c8edddd274e5b438d798de6675380f8fea117dcf83d49ff/68747470733a2f2f706f7365722e707567782e6f72672f646d742d736f6674776172652f617572612d7765622d7073722f6c6963656e7365)](https://packagist.org/packages/dmt-software/aura-web-psr)

Introduction
------------

[](#introduction)

Aura.Web implementations do not follow [PSR-7](https://www.php-fig.org/psr/psr-7/), the recommendation for HTTP messages. As more and more packages that solve common HTTP message problems do implement this recommendation, it would be nice if these can be used for Aura.Web implementations too. This package will allow you to start implementing PSR-7 without changing the library underneath, preserving the current code usage [1](#1) to make migration or [refactoring](#usage-during-migration) easier.

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

[](#installation)

> Although Aura.Web still supports down to PHP 5.3, this package needs PHP 7.0 or higher. Older implementations need to migrate to PHP 7 before this package can be used. I would suggest to use [rector/rector](https://packagist.org/packages/rector/rector) to make this upgrade a more simple task.

### Using composer

[](#using-composer)

`composer require dmt-software/aura-web-psr`

Usage
-----

[](#usage)

### Creating a ServerRequest

[](#creating-a-serverrequest)

```
use DMT\Aura\Psr\Message\ServerRequest;

// creating a request from $_SERVER variable
$serverRequest = new ServerRequest(
    $_SERVER['REQUEST_METHOD'] ?? 'GET',
    $_SERVER['REQUEST_URI'] ?? '/',
    $_SERVER
);
```

### Handling uploaded files

[](#handling-uploaded-files)

```
use DMT\Aura\Psr\Factory\UploadedFileFactory;
use DMT\Aura\Psr\Message\ServerRequest;
use DMT\Aura\Psr\Message\UploadedFile;

/** @var ServerRequest $serverRequest */
$serverRequest = $serverRequest->withUploadedFiles(
    /** @var UploadedFileFactory $uploadedFileFactory */
    $uploadedFileFactory->createUploadedFilesFromGlobalFiles($_FILES)
);

// at some later point
foreach ($serverRequest->getUploadedFiles() as $uploadedFile) {
    /** @var UploadedFile $uploadedFile */
    if ($uploadedFile->getError() === \UPLOAD_ERR_OK) {
        // ... process the uploaded file
    }
}
```

### Creating a Response

[](#creating-a-response)

```
use DMT\Aura\Psr\Message\Response;

$response = new Response(200, 'Ok');
$response->getBody()->write(/** your response html */);
```

Usage during migration
----------------------

[](#usage-during-migration)

### Wrapped objects

[](#wrapped-objects)

All PSR-7 http-messages wrap an Aura.Web object. According to their responsibility this can be any of the request or response objects. These objects can be retrieved by calling the `getInnerObject()` method on the http-message.

```
use DMT\Aura\Psr\Message\ServerRequest;

$serverRequest = new ServerRequest(
    $_SERVER['REQUEST_METHOD'] ?? 'GET',
    $_SERVER['REQUEST_URI'] ?? '/',
    $_SERVER
);

$request = $serverRequest->getInnerObject();

// somewhere within the "legacy" code
if ($request->isPost()) {
    // process post data
}
```

### Immutability

[](#immutability)

Changes to the http-messages will be internally tracked by the wrapped objects, but in such a way that the immutability of the message is preserved. This means each change that is made to a message object will return a new Aura.Web object instance.

```
use DMT\Aura\Psr\Message\ServerRequest;

/** @var ServerRequest $serverRequest */
$auraRequest = $serverRequest->getInnerObject();

// new server request is returned with a fresh Aura.Web request
$serverRequest = $serverRequest->withProtocolVersion('2');
$newAuraRequest = $serverRequest->getInnerObject();

if ($auraRequest->server->get('SERVER_PROTOCOL') != $newAuraRequest->server->get('SERVER_PROTOCOL')) {
    print 'Protocol version has changed';
}
```

> Make sure each time a http-message is changed, the aura request must be retrieved from the new message instance too.

### Incompatibility

[](#incompatibility)

Some build in solutions, like uploading files, receiving a json post, etc are not available when this package is used. For an overview of how to cope with these discrepancies see the [compatibility](/docs/compatibility.md) documentation.

That http-messages use (a part of) the Aura.Web objects does not mean it is true the other way around. Some aura objects are not managed by the http-messages. For managing these objects one can fallback to the original code (once the inner object is retrieved) or use/write some additional code that works similar. See the [workarounds](/docs/workarounds.md)documentation for tips and tricks on this subject.

1: to the best of my ability

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1906d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec6b7fbb4d231b5c2c76348cf3a13ec5e82c64a1826142f6ec0db1cf15db2873?d=identicon)[proggeler](/maintainers/proggeler)

---

Top Contributors

[![proggeler](https://avatars.githubusercontent.com/u/18281353?v=4)](https://github.com/proggeler "proggeler (40 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dmt-software-aura-web-psr/health.svg)

```
[![Health](https://phpackages.com/badges/dmt-software-aura-web-psr/health.svg)](https://phpackages.com/packages/dmt-software-aura-web-psr)
```

###  Alternatives

[saloonphp/saloon

Build beautiful API integrations and SDKs with Saloon

2.4k9.6M467](/packages/saloonphp-saloon)[thecodingmachine/graphqlite

Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).

5723.1M30](/packages/thecodingmachine-graphqlite)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

963.1M35](/packages/getbrevo-brevo-php)[swisnl/json-api-client

A PHP package for mapping remote JSON:API resources to Eloquent like models and collections.

211473.2k12](/packages/swisnl-json-api-client)[wordpress/php-ai-client

A provider agnostic PHP AI client SDK to communicate with any generative AI models of various capabilities using a uniform API.

26236.6k14](/packages/wordpress-php-ai-client)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
