{"id":39855335,"url":"https://github.com/dmt-software/aura-web-psr","last_synced_at":"2026-01-18T13:50:03.063Z","repository":{"id":56970354,"uuid":"332024444","full_name":"dmt-software/aura-web-psr","owner":"dmt-software","description":null,"archived":false,"fork":false,"pushed_at":"2021-12-31T16:32:18.000Z","size":171,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-15T16:21:10.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmt-software.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-22T18:03:07.000Z","updated_at":"2021-12-31T16:32:21.000Z","dependencies_parsed_at":"2022-08-21T06:30:06.422Z","dependency_job_id":null,"html_url":"https://github.com/dmt-software/aura-web-psr","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dmt-software/aura-web-psr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmt-software%2Faura-web-psr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmt-software%2Faura-web-psr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmt-software%2Faura-web-psr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmt-software%2Faura-web-psr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmt-software","download_url":"https://codeload.github.com/dmt-software/aura-web-psr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmt-software%2Faura-web-psr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28537015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T13:04:05.990Z","status":"ssl_error","status_checked_at":"2026-01-18T13:01:44.092Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-18T13:50:02.216Z","updated_at":"2026-01-18T13:50:02.970Z","avatar_url":"https://github.com/dmt-software.png","language":"PHP","readme":"# Aura Web PSR-7 wrapper\n\n[![Latest Stable Version](https://poser.pugx.org/dmt-software/aura-web-psr/v/stable)](https://packagist.org/packages/dmt-software/aura-web-psr)\n[![Build Status](https://travis-ci.com/dmt-software/aura-web-psr.svg?branch=master)](https://travis-ci.com/dmt-software/aura-web-psr)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dmt-software/aura-web-psr/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dmt-software/aura-web-psr/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/dmt-software/aura-web-psr/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/dmt-software/aura-web-psr/?branch=master)\n[![License](https://poser.pugx.org/dmt-software/aura-web-psr/license)](https://packagist.org/packages/dmt-software/aura-web-psr)\n\n## Introduction\nAura.Web implementations do not follow [PSR-7](https://www.php-fig.org/psr/psr-7/), the recommendation for HTTP \nmessages. As more and more packages that solve common HTTP message problems do implement this recommendation, it would \nbe nice if these can be used for Aura.Web implementations too. This package will allow you to start implementing PSR-7 \nwithout changing the library underneath, preserving the current code usage \u003csup\u003e[1](#1)\u003c/sup\u003e to make migration or \n[refactoring](#usage-during-migration) easier.\n\n## Installation\n\n\u003e Although Aura.Web still supports down to PHP 5.3, this package needs PHP 7.0 or higher. Older implementations need to \n\u003e migrate to PHP 7 before this package can be used. I would suggest to use \n\u003e [rector/rector](https://packagist.org/packages/rector/rector) to make this upgrade a more simple task.     \n  \n\n### Using composer\n\n```composer require dmt-software/aura-web-psr```\n\n## Usage\n\n### Creating a ServerRequest\n\n```php\nuse DMT\\Aura\\Psr\\Message\\ServerRequest;\n \n// creating a request from $_SERVER variable\n$serverRequest = new ServerRequest(\n    $_SERVER['REQUEST_METHOD'] ?? 'GET',\n    $_SERVER['REQUEST_URI'] ?? '/',\n    $_SERVER\n);\n```\n\n### Handling uploaded files\n\n```php\nuse DMT\\Aura\\Psr\\Factory\\UploadedFileFactory;\nuse DMT\\Aura\\Psr\\Message\\ServerRequest;\nuse DMT\\Aura\\Psr\\Message\\UploadedFile;\n \n/** @var ServerRequest $serverRequest */\n$serverRequest = $serverRequest-\u003ewithUploadedFiles(\n    /** @var UploadedFileFactory $uploadedFileFactory */\n    $uploadedFileFactory-\u003ecreateUploadedFilesFromGlobalFiles($_FILES)\n);\n \n// at some later point \nforeach ($serverRequest-\u003egetUploadedFiles() as $uploadedFile) {\n    /** @var UploadedFile $uploadedFile */\n    if ($uploadedFile-\u003egetError() === \\UPLOAD_ERR_OK) {\n        // ... process the uploaded file\n    }\n}\n```\n\n### Creating a Response\n\n```php\nuse DMT\\Aura\\Psr\\Message\\Response;\n \n$response = new Response(200, 'Ok');\n$response-\u003egetBody()-\u003ewrite(/** your response html */);\n```\n\n## Usage during migration \n\n### Wrapped objects\n\nAll PSR-7 http-messages wrap an Aura.Web object. According to their responsibility this can be any of the request or\nresponse objects. These objects can be retrieved by calling the `getInnerObject()` method on the http-message.\n\n```php \nuse DMT\\Aura\\Psr\\Message\\ServerRequest;\n \n$serverRequest = new ServerRequest(\n    $_SERVER['REQUEST_METHOD'] ?? 'GET',\n    $_SERVER['REQUEST_URI'] ?? '/',\n    $_SERVER\n); \n \n$request = $serverRequest-\u003egetInnerObject();\n\n// somewhere within the \"legacy\" code\nif ($request-\u003eisPost()) {\n    // process post data \n}\n```\n\n### Immutability\n\nChanges to the http-messages will be internally tracked by the wrapped objects, but in such a way that\nthe immutability of the message is preserved. This means each change that is made to a message object will return a new \nAura.Web object instance. \n```php\nuse DMT\\Aura\\Psr\\Message\\ServerRequest;\n \n/** @var ServerRequest $serverRequest */ \n$auraRequest = $serverRequest-\u003egetInnerObject();\n \n// new server request is returned with a fresh Aura.Web request \n$serverRequest = $serverRequest-\u003ewithProtocolVersion('2');\n$newAuraRequest = $serverRequest-\u003egetInnerObject();\n\nif ($auraRequest-\u003eserver-\u003eget('SERVER_PROTOCOL') != $newAuraRequest-\u003eserver-\u003eget('SERVER_PROTOCOL')) {\n    print 'Protocol version has changed';\n}\n```\n\u003e Make sure each time a http-message is changed, the aura request must be retrieved from the new message instance too.  \n \n### Incompatibility\n\nSome build in solutions, like uploading files, receiving a json post, etc are not available when this package is used.\nFor an overview of how to cope with these discrepancies see the [compatibility](/docs/compatibility.md) documentation.\n\nThat http-messages use (a part of) the Aura.Web objects does not mean it is true the other way around. Some aura objects\nare not managed by the http-messages. For managing these objects one can fallback to the original code (once the inner\nobject is retrieved) or use/write some additional code that works similar. See the [workarounds](/docs/workarounds.md) \ndocumentation for tips and tricks on this subject.     \n\n\n\n\u003ca name=\"1\"\u003e\u003c/a\u003e\n\u003csup\u003e1: to the best of my ability\u003c/sup\u003e ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmt-software%2Faura-web-psr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmt-software%2Faura-web-psr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmt-software%2Faura-web-psr/lists"}