ADD: required nyholm/psr7server

This commit is contained in:
lukibeg 2025-10-16 10:47:45 -03:00
parent 497b480c2f
commit bc539b2ab5
3 changed files with 79 additions and 4 deletions

View File

@ -13,6 +13,7 @@
], ],
"require": { "require": {
"psr/http-message": "^2.0", "psr/http-message": "^2.0",
"nyholm/psr7": "^1.8" "nyholm/psr7": "^1.8",
"nyholm/psr7-server": "^1.1"
} }
} }

68
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "b2ffab63d5bda6b880d677f709bf179b", "content-hash": "9c15ad4fc717c578191a8cd9b9095bd0",
"packages": [ "packages": [
{ {
"name": "nyholm/psr7", "name": "nyholm/psr7",
@ -84,6 +84,72 @@
], ],
"time": "2024-09-09T07:06:30+00:00" "time": "2024-09-09T07:06:30+00:00"
}, },
{
"name": "nyholm/psr7-server",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/Nyholm/psr7-server.git",
"reference": "4335801d851f554ca43fa6e7d2602141538854dc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Nyholm/psr7-server/zipball/4335801d851f554ca43fa6e7d2602141538854dc",
"reference": "4335801d851f554ca43fa6e7d2602141538854dc",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0 || ^2.0"
},
"require-dev": {
"nyholm/nsa": "^1.1",
"nyholm/psr7": "^1.3",
"phpunit/phpunit": "^7.0 || ^8.5 || ^9.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Nyholm\\Psr7Server\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com"
},
{
"name": "Martijn van der Ven",
"email": "martijn@vanderven.se"
}
],
"description": "Helper classes to handle PSR-7 server requests",
"homepage": "http://tnyholm.se",
"keywords": [
"psr-17",
"psr-7"
],
"support": {
"issues": "https://github.com/Nyholm/psr7-server/issues",
"source": "https://github.com/Nyholm/psr7-server/tree/1.1.0"
},
"funding": [
{
"url": "https://github.com/Zegnat",
"type": "github"
},
{
"url": "https://github.com/nyholm",
"type": "github"
}
],
"time": "2023-11-08T09:30:43+00:00"
},
{ {
"name": "psr/http-factory", "name": "psr/http-factory",
"version": "1.1.0", "version": "1.1.0",

View File

@ -8,7 +8,15 @@ use Routes\Router;
$router = new Router(); $router = new Router();
$psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
$uri = $_SERVER['REQUEST_URI']; $creator = new \Nyholm\Psr7Server\ServerRequestCreator(
$psr17Factory, // ServerRequestFactory
$psr17Factory, // UriFactory
$psr17Factory, // UploadedFileFactory
$psr17Factory // StreamFactory
);
print_r($uri); $serverRequest = $creator->fromGlobals();
print_r($serverRequest->getUri());