diff --git a/composer.json b/composer.json index e8a29456..9244c0a6 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "upf" ], "license": "MIT", + "minimum-stability": "dev", "autoload": { "psr-4": { "Utopia\\": "src/" @@ -29,7 +30,7 @@ "require": { "php": ">=8.0", "ext-swoole": "*", - "utopia-php/di": "dev-main" + "utopia-php/servers": "dev-dev" }, "require-dev": { "ext-xdebug": "*", @@ -40,6 +41,10 @@ "phpbench/phpbench": "^1.2" }, "repositories": [ + { + "type": "vcs", + "url": "https://github.com/utopia-php/servers" + }, { "type": "vcs", "url": "https://github.com/utopia-php/di" diff --git a/composer.lock b/composer.lock index c9a95fa5..6ced2394 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9fb7534dc954b1f29c6d74dbfcf1a296", + "content-hash": "f961290f450cd8657302383ece07a86b", "packages": [ { "name": "utopia-php/di", @@ -67,21 +67,92 @@ "issues": "https://github.com/utopia-php/di/issues" }, "time": "2024-04-18T20:06:02+00:00" + }, + { + "name": "utopia-php/servers", + "version": "dev-dev", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/servers.git", + "reference": "20bb7ab93c21d0ae37bc309d41b70ddf2a78a6fd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/servers/zipball/20bb7ab93c21d0ae37bc309d41b70ddf2a78a6fd", + "reference": "20bb7ab93c21d0ae37bc309d41b70ddf2a78a6fd", + "shasum": "" + }, + "require": { + "php": ">=8.0", + "utopia-php/di": "dev-main" + }, + "require-dev": { + "laravel/pint": "^0.2.3", + "phpstan/phpstan": "^1.8", + "phpunit/phpunit": "^9.5.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Servers\\": "src/Servers" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\E2E\\": "tests/Servers/Unit" + } + }, + "scripts": { + "test": [ + "phpunit" + ], + "analyse": [ + "vendor/bin/phpstan analyse" + ], + "format": [ + "vendor/bin/pint" + ], + "lint": [ + "vendor/bin/pint --test" + ] + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Team Appwrite", + "email": "team@appwrite.io" + } + ], + "description": "A base library for building Utopia style servers.", + "keywords": [ + "framework", + "php", + "servers", + "upf", + "utopia" + ], + "support": { + "source": "https://github.com/utopia-php/servers/tree/dev", + "issues": "https://github.com/utopia-php/servers/issues" + }, + "time": "2024-04-21T18:53:43+00:00" } ], "packages-dev": [ { "name": "doctrine/annotations", - "version": "2.0.1", + "version": "2.0.x-dev", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f" + "reference": "94f40ad7ecbc6931958faa8a57c48dce5da2b468" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", - "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/94f40ad7ecbc6931958faa8a57c48dce5da2b468", + "reference": "94f40ad7ecbc6931958faa8a57c48dce5da2b468", "shasum": "" }, "require": { @@ -101,6 +172,7 @@ "suggest": { "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -142,37 +214,38 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/2.0.1" + "source": "https://github.com/doctrine/annotations/tree/2.0.x" }, - "time": "2023-02-02T22:02:53+00:00" + "time": "2023-08-23T17:36:07+00:00" }, { "name": "doctrine/instantiator", - "version": "2.0.0", + "version": "2.0.x-dev", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" + "reference": "6c0ee619435c5d4f3bc515ab1514cf4cf1006c6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/6c0ee619435c5d4f3bc515ab1514cf4cf1006c6e", + "reference": "6c0ee619435c5d4f3bc515ab1514cf4cf1006c6e", "shasum": "" }, "require": { "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^11", + "doctrine/coding-standard": "^12", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^1.2", "phpstan/phpstan": "^1.9.4", "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", + "phpunit/phpunit": "^10.5", "vimeo/psalm": "^5.4" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -198,7 +271,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.x" }, "funding": [ { @@ -214,20 +287,20 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:23:10+00:00" + "time": "2023-12-09T14:19:21+00:00" }, { "name": "doctrine/lexer", - "version": "3.0.1", + "version": "3.1.x-dev", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd" + "reference": "cd03cc3c085aa94b046bd2d342b08d6b0e5d834f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", - "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/cd03cc3c085aa94b046bd2d342b08d6b0e5d834f", + "reference": "cd03cc3c085aa94b046bd2d342b08d6b0e5d834f", "shasum": "" }, "require": { @@ -275,7 +348,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/3.0.1" + "source": "https://github.com/doctrine/lexer/tree/3.1.x" }, "funding": [ { @@ -291,7 +364,7 @@ "type": "tidelift" } ], - "time": "2024-02-05T11:56:58+00:00" + "time": "2024-02-05T12:02:27+00:00" }, { "name": "laravel/pint", @@ -361,16 +434,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "2f5294676c802a62b0549f6bc8983f14294ce369" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/2f5294676c802a62b0549f6bc8983f14294ce369", + "reference": "2f5294676c802a62b0549f6bc8983f14294ce369", "shasum": "" }, "require": { @@ -378,13 +451,15 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, + "default-branch": true, "type": "library", "autoload": { "files": [ @@ -408,7 +483,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.x" }, "funding": [ { @@ -416,20 +491,20 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-02-10T11:10:03+00:00" }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "c5ee33df86c06b3278c670f64273b1ba768a0744" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c5ee33df86c06b3278c670f64273b1ba768a0744", + "reference": "c5ee33df86c06b3278c670f64273b1ba768a0744", "shasum": "" }, "require": { @@ -440,8 +515,9 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, + "default-branch": true, "bin": [ "bin/php-parse" ], @@ -472,13 +548,13 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/master" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-04-19T12:04:10+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.4", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", @@ -498,6 +574,7 @@ "phar-io/version": "^3.0.1", "php": "^7.2 || ^8.0" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -596,7 +673,7 @@ }, { "name": "phpbench/container", - "version": "2.2.2", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/phpbench/container.git", @@ -617,6 +694,7 @@ "phpstan/phpstan": "^0.12.52", "phpunit/phpunit": "^8" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -698,16 +776,16 @@ }, { "name": "phpbench/phpbench", - "version": "1.2.15", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/phpbench/phpbench.git", - "reference": "f7000319695cfad04a57fc64bf7ef7abdf4c437c" + "reference": "c4af952ad3e19cc1a754b98f1ea47a10371e1749" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpbench/phpbench/zipball/f7000319695cfad04a57fc64bf7ef7abdf4c437c", - "reference": "f7000319695cfad04a57fc64bf7ef7abdf4c437c", + "url": "https://api.github.com/repos/phpbench/phpbench/zipball/c4af952ad3e19cc1a754b98f1ea47a10371e1749", + "reference": "c4af952ad3e19cc1a754b98f1ea47a10371e1749", "shasum": "" }, "require": { @@ -719,33 +797,39 @@ "ext-spl": "*", "ext-tokenizer": "*", "php": "^8.1", - "phpbench/container": "^2.1", + "phpbench/container": "^2.2", "phpbench/dom": "~0.3.3", "psr/log": "^1.1 || ^2.0 || ^3.0", "seld/jsonlint": "^1.1", - "symfony/console": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/filesystem": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/finder": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/options-resolver": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/process": "^4.2 || ^5.0 || ^6.0 || ^7.0", + "symfony/console": "^6.1 || ^7.0", + "symfony/filesystem": "^6.1 || ^7.0", + "symfony/finder": "^6.1 || ^7.0", + "symfony/options-resolver": "^6.1 || ^7.0", + "symfony/process": "^6.1 || ^7.0", "webmozart/glob": "^4.6" }, + "replace": { + "symfony/polyfill-php80": "*", + "symfony/polyfill-php81": "*" + }, "require-dev": { "dantleech/invoke": "^2.0", + "ergebnis/composer-normalize": "^2.39", "friendsofphp/php-cs-fixer": "^3.0", "jangregor/phpstan-prophecy": "^1.0", "phpspec/prophecy": "dev-master", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.0", "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^10.0", - "rector/rector": "^0.18.10", - "symfony/error-handler": "^5.2 || ^6.0 || ^7.0", - "symfony/var-dumper": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^10.4", + "rector/rector": "^0.18.11 || ^1.0.0", + "symfony/error-handler": "^6.1 || ^7.0", + "symfony/var-dumper": "^6.1 || ^7.0" }, "suggest": { "ext-xdebug": "For Xdebug profiling extension." }, + "default-branch": true, "bin": [ "bin/phpbench" ], @@ -784,7 +868,7 @@ ], "support": { "issues": "https://github.com/phpbench/phpbench/issues", - "source": "https://github.com/phpbench/phpbench/tree/1.2.15" + "source": "https://github.com/phpbench/phpbench/tree/master" }, "funding": [ { @@ -792,20 +876,20 @@ "type": "github" } ], - "time": "2023-11-29T12:21:11+00:00" + "time": "2024-04-10T12:50:15+00:00" }, { "name": "phpstan/phpstan", - "version": "1.10.67", + "version": "1.11.x-dev", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493" + "reference": "3b03bac1068a585926a14e97692baef8642c2a1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493", - "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3b03bac1068a585926a14e97692baef8642c2a1b", + "reference": "3b03bac1068a585926a14e97692baef8642c2a1b", "shasum": "" }, "require": { @@ -814,6 +898,7 @@ "conflict": { "phpstan/phpstan-shim": "*" }, + "default-branch": true, "bin": [ "phpstan", "phpstan.phar" @@ -850,20 +935,20 @@ "type": "github" } ], - "time": "2024-04-16T07:22:02+00:00" + "time": "2024-04-22T13:39:03+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.31", + "version": "9.2.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" + "reference": "3352293d9e91513d5508c415835014881b420218" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/3352293d9e91513d5508c415835014881b420218", + "reference": "3352293d9e91513d5508c415835014881b420218", "shasum": "" }, "require": { @@ -920,7 +1005,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2" }, "funding": [ { @@ -928,20 +1013,20 @@ "type": "github" } ], - "time": "2024-03-02T06:37:42+00:00" + "time": "2024-03-22T05:16:32+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "3.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "38b24367e1b340aa78b96d7cab042942d917bb84" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/38b24367e1b340aa78b96d7cab042942d917bb84", + "reference": "38b24367e1b340aa78b96d7cab042942d917bb84", "shasum": "" }, "require": { @@ -980,7 +1065,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0" }, "funding": [ { @@ -988,7 +1073,7 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2022-02-11T16:23:04+00:00" }, { "name": "phpunit/php-invoker", @@ -1173,16 +1258,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.19", + "version": "9.6.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" + "reference": "33a0610878994fc134c74c25d5276d606d49079b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/33a0610878994fc134c74c25d5276d606d49079b", + "reference": "33a0610878994fc134c74c25d5276d606d49079b", "shasum": "" }, "require": { @@ -1256,7 +1341,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6" }, "funding": [ { @@ -1272,29 +1357,33 @@ "type": "tidelift" } ], - "time": "2024-04-05T04:35:58+00:00" + "time": "2024-04-20T06:05:08+00:00" }, { "name": "psr/cache", - "version": "3.0.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + "reference": "0a7c67d0d1c8167b342eb74339d6f961663826ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "url": "https://api.github.com/repos/php-fig/cache/zipball/0a7c67d0d1c8167b342eb74339d6f961663826ce", + "reference": "0a7c67d0d1c8167b342eb74339d6f961663826ce", "shasum": "" }, "require": { "php": ">=8.0.0" }, + "suggest": { + "fig/cache-util": "Provides some useful PSR-6 utilities" + }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1319,27 +1408,28 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/3.0.0" + "source": "https://github.com/php-fig/cache/tree/master" }, - "time": "2021-02-03T23:26:27+00:00" + "time": "2021-02-24T03:25:37+00:00" }, { "name": "psr/container", - "version": "2.0.2", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + "reference": "707984727bd5b2b670e59559d3ed2500240cf875" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "url": "https://api.github.com/repos/php-fig/container/zipball/707984727bd5b2b670e59559d3ed2500240cf875", + "reference": "707984727bd5b2b670e59559d3ed2500240cf875", "shasum": "" }, "require": { "php": ">=7.4.0" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -1372,13 +1462,13 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/2.0.2" + "source": "https://github.com/php-fig/container" }, - "time": "2021-11-05T16:47:00+00:00" + "time": "2023-09-22T11:11:30+00:00" }, { "name": "psr/log", - "version": "3.0.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", @@ -1393,6 +1483,7 @@ "require": { "php": ">=8.0.0" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -1428,7 +1519,7 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.2", + "version": "1.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", @@ -1595,16 +1686,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "4.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "b247957a1c8dc81a671770f74b479c0a78a818f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/b247957a1c8dc81a671770f74b479c0a78a818f1", + "reference": "b247957a1c8dc81a671770f74b479c0a78a818f1", "shasum": "" }, "require": { @@ -1657,7 +1748,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0" }, "funding": [ { @@ -1665,11 +1756,11 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2022-09-14T12:46:14+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.3", + "version": "2.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", @@ -1726,7 +1817,7 @@ }, { "name": "sebastian/diff", - "version": "4.0.6", + "version": "4.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", @@ -1792,7 +1883,7 @@ }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "5.1.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", @@ -1843,7 +1934,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1" }, "funding": [ { @@ -1855,7 +1946,7 @@ }, { "name": "sebastian/exporter", - "version": "4.0.6", + "version": "4.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", @@ -1932,7 +2023,7 @@ }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "5.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", @@ -1996,7 +2087,7 @@ }, { "name": "sebastian/lines-of-code", - "version": "1.0.4", + "version": "1.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", @@ -2165,7 +2256,7 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "4.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", @@ -2228,16 +2319,16 @@ }, { "name": "sebastian/resource-operations", - "version": "3.0.4", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" + "reference": "ff553e7482dcee39fa4acc2b175d6ddeb0f7bc25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ff553e7482dcee39fa4acc2b175d6ddeb0f7bc25", + "reference": "ff553e7482dcee39fa4acc2b175d6ddeb0f7bc25", "shasum": "" }, "require": { @@ -2246,6 +2337,7 @@ "require-dev": { "phpunit/phpunit": "^9.0" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -2270,7 +2362,7 @@ "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/main" }, "funding": [ { @@ -2278,11 +2370,11 @@ "type": "github" } ], - "time": "2024-03-14T16:00:52+00:00" + "time": "2024-03-14T18:47:08+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "3.2.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", @@ -2326,7 +2418,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "source": "https://github.com/sebastianbergmann/type/tree/3.2" }, "funding": [ { @@ -2338,7 +2430,7 @@ }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "3.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", @@ -2497,16 +2589,16 @@ }, { "name": "symfony/console", - "version": "v7.0.6", + "version": "7.1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "fde915cd8e7eb99b3d531d3d5c09531429c3f9e5" + "reference": "1b84910b638ce3265e132d7b42405b2db64f6f69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fde915cd8e7eb99b3d531d3d5c09531429c3f9e5", - "reference": "fde915cd8e7eb99b3d531d3d5c09531429c3f9e5", + "url": "https://api.github.com/repos/symfony/console/zipball/1b84910b638ce3265e132d7b42405b2db64f6f69", + "reference": "1b84910b638ce3265e132d7b42405b2db64f6f69", "shasum": "" }, "require": { @@ -2570,7 +2662,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.0.6" + "source": "https://github.com/symfony/console/tree/7.1" }, "funding": [ { @@ -2586,29 +2678,30 @@ "type": "tidelift" } ], - "time": "2024-04-01T11:04:53+00:00" + "time": "2024-04-06T17:55:56+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.4.0", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + "reference": "2c438b99bb2753c1628c1e6f523991edea5b03a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/2c438b99bb2753c1628c1e6f523991edea5b03a4", + "reference": "2c438b99bb2753c1628c1e6f523991edea5b03a4", "shasum": "" }, "require": { "php": ">=8.1" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -2637,7 +2730,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/main" }, "funding": [ { @@ -2653,26 +2746,27 @@ "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2024-01-02T14:07:37+00:00" }, { "name": "symfony/filesystem", - "version": "v7.0.6", + "version": "7.1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "408105dff4c104454100730bdfd1a9cdd993f04d" + "reference": "47d346741881ecf75f6b6474b52f0781e6c42af7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/408105dff4c104454100730bdfd1a9cdd993f04d", - "reference": "408105dff4c104454100730bdfd1a9cdd993f04d", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/47d346741881ecf75f6b6474b52f0781e6c42af7", + "reference": "47d346741881ecf75f6b6474b52f0781e6c42af7", "shasum": "" }, "require": { "php": ">=8.2", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8" + "symfony/polyfill-mbstring": "~1.8", + "symfony/process": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -2700,7 +2794,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.0.6" + "source": "https://github.com/symfony/filesystem/tree/7.1" }, "funding": [ { @@ -2716,20 +2810,20 @@ "type": "tidelift" } ], - "time": "2024-03-21T19:37:36+00:00" + "time": "2024-04-16T16:29:43+00:00" }, { "name": "symfony/finder", - "version": "v7.0.0", + "version": "7.1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56" + "reference": "9bfc6ffa24b1b66f7c3c9f71b2870e1413c1ce03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/6e5688d69f7cfc4ed4a511e96007e06c2d34ce56", - "reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56", + "url": "https://api.github.com/repos/symfony/finder/zipball/9bfc6ffa24b1b66f7c3c9f71b2870e1413c1ce03", + "reference": "9bfc6ffa24b1b66f7c3c9f71b2870e1413c1ce03", "shasum": "" }, "require": { @@ -2764,7 +2858,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.0.0" + "source": "https://github.com/symfony/finder/tree/7.1" }, "funding": [ { @@ -2780,20 +2874,20 @@ "type": "tidelift" } ], - "time": "2023-10-31T17:59:56+00:00" + "time": "2024-03-20T15:26:56+00:00" }, { "name": "symfony/options-resolver", - "version": "v7.0.0", + "version": "7.1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "700ff4096e346f54cb628ea650767c8130f1001f" + "reference": "9564f64c16f99e29f252eafc642965e8fcb755ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/700ff4096e346f54cb628ea650767c8130f1001f", - "reference": "700ff4096e346f54cb628ea650767c8130f1001f", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/9564f64c16f99e29f252eafc642965e8fcb755ce", + "reference": "9564f64c16f99e29f252eafc642965e8fcb755ce", "shasum": "" }, "require": { @@ -2831,7 +2925,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.0.0" + "source": "https://github.com/symfony/options-resolver/tree/7.1" }, "funding": [ { @@ -2847,20 +2941,20 @@ "type": "tidelift" } ], - "time": "2023-08-08T10:20:21+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "reference": "c9e59dec962d38cf2e0e4c61c4a1a1312f4dd7fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c9e59dec962d38cf2e0e4c61c4a1a1312f4dd7fe", + "reference": "c9e59dec962d38cf2e0e4c61c4a1a1312f4dd7fe", "shasum": "" }, "require": { @@ -2872,6 +2966,7 @@ "suggest": { "ext-ctype": "For best performance" }, + "default-branch": true, "type": "library", "extra": { "thanks": { @@ -2910,7 +3005,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/1.x" }, "funding": [ { @@ -2926,20 +3021,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-04-19T06:31:17+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + "reference": "0a1df740cbb01859ce1bac85b0ad58ffe02f69b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/0a1df740cbb01859ce1bac85b0ad58ffe02f69b6", + "reference": "0a1df740cbb01859ce1bac85b0ad58ffe02f69b6", "shasum": "" }, "require": { @@ -2948,6 +3043,7 @@ "suggest": { "ext-intl": "For best performance" }, + "default-branch": true, "type": "library", "extra": { "thanks": { @@ -2988,7 +3084,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/1.x" }, "funding": [ { @@ -3004,20 +3100,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-04-19T06:31:17+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + "reference": "2a090dc3db090fcb35cc7329d18a07f281f15d79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/2a090dc3db090fcb35cc7329d18a07f281f15d79", + "reference": "2a090dc3db090fcb35cc7329d18a07f281f15d79", "shasum": "" }, "require": { @@ -3026,6 +3122,7 @@ "suggest": { "ext-intl": "For best performance" }, + "default-branch": true, "type": "library", "extra": { "thanks": { @@ -3069,7 +3166,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/1.x" }, "funding": [ { @@ -3085,20 +3182,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-04-19T06:31:17+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + "reference": "e642fbe7a7b73cdb05460555289a9057bfd6ead6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e642fbe7a7b73cdb05460555289a9057bfd6ead6", + "reference": "e642fbe7a7b73cdb05460555289a9057bfd6ead6", "shasum": "" }, "require": { @@ -3110,6 +3207,7 @@ "suggest": { "ext-mbstring": "For best performance" }, + "default-branch": true, "type": "library", "extra": { "thanks": { @@ -3149,7 +3247,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/1.x" }, "funding": [ { @@ -3165,20 +3263,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-04-19T06:31:17+00:00" }, { "name": "symfony/process", - "version": "v7.0.4", + "version": "7.1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "0e7727191c3b71ebec6d529fa0e50a01ca5679e9" + "reference": "8e99b1b15d2975b242fc089382c8f8055a85d996" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/0e7727191c3b71ebec6d529fa0e50a01ca5679e9", - "reference": "0e7727191c3b71ebec6d529fa0e50a01ca5679e9", + "url": "https://api.github.com/repos/symfony/process/zipball/8e99b1b15d2975b242fc089382c8f8055a85d996", + "reference": "8e99b1b15d2975b242fc089382c8f8055a85d996", "shasum": "" }, "require": { @@ -3210,7 +3308,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.0.4" + "source": "https://github.com/symfony/process/tree/7.1" }, "funding": [ { @@ -3226,33 +3324,35 @@ "type": "tidelift" } ], - "time": "2024-02-22T20:27:20+00:00" + "time": "2024-04-05T09:28:19+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.4.2", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "11bbf19a0fb7b36345861e85c5768844c552906e" + "reference": "a17e69656265139c2ab4a62529f495a2a41fd6ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/11bbf19a0fb7b36345861e85c5768844c552906e", - "reference": "11bbf19a0fb7b36345861e85c5768844c552906e", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a17e69656265139c2ab4a62529f495a2a41fd6ce", + "reference": "a17e69656265139c2ab4a62529f495a2a41fd6ce", "shasum": "" }, "require": { "php": ">=8.1", - "psr/container": "^1.1|^2.0" + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { "ext-psr": "<1.1|>=2" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3292,7 +3392,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.4.2" + "source": "https://github.com/symfony/service-contracts/tree/main" }, "funding": [ { @@ -3308,20 +3408,20 @@ "type": "tidelift" } ], - "time": "2023-12-19T21:51:00+00:00" + "time": "2024-04-05T09:39:30+00:00" }, { "name": "symfony/string", - "version": "v7.0.4", + "version": "7.1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "f5832521b998b0bec40bee688ad5de98d4cf111b" + "reference": "236b450c00ab6560e6cda684853d2db3c6b41731" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/f5832521b998b0bec40bee688ad5de98d4cf111b", - "reference": "f5832521b998b0bec40bee688ad5de98d4cf111b", + "url": "https://api.github.com/repos/symfony/string/zipball/236b450c00ab6560e6cda684853d2db3c6b41731", + "reference": "236b450c00ab6560e6cda684853d2db3c6b41731", "shasum": "" }, "require": { @@ -3335,6 +3435,7 @@ "symfony/translation-contracts": "<2.5" }, "require-dev": { + "symfony/emoji": "^7.1", "symfony/error-handler": "^6.4|^7.0", "symfony/http-client": "^6.4|^7.0", "symfony/intl": "^6.4|^7.0", @@ -3378,7 +3479,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.0.4" + "source": "https://github.com/symfony/string/tree/7.1" }, "funding": [ { @@ -3394,7 +3495,7 @@ "type": "tidelift" } ], - "time": "2024-02-01T13:17:36+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "theseer/tokenizer", @@ -3448,7 +3549,7 @@ }, { "name": "webmozart/glob", - "version": "4.7.0", + "version": "4.8.x-dev", "source": { "type": "git", "url": "https://github.com/webmozarts/glob.git", @@ -3497,9 +3598,9 @@ } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "dev", "stability-flags": { - "utopia-php/di": 20 + "utopia-php/servers": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/src/Http/Adapter/FPM/Request.php b/src/Http/Adapter/FPM/Request.php index ecabb457..bdc8ebf5 100644 --- a/src/Http/Adapter/FPM/Request.php +++ b/src/Http/Adapter/FPM/Request.php @@ -165,6 +165,33 @@ public function setURI(string $uri): static return $this; } + /** + * Get Query String + * + * Return HTTP request query string + * + * @return string + */ + public function getQueryString(): string + { + return $this->getServer('QUERY_STRING') ?? ''; + } + + /** + * Set Query String + * + * Set HTTP request query string + * + * @param string $value + * @return static + */ + public function setQueryString(string $value): static + { + $this->setServer('QUERY_STRING', $value); + + return $this; + } + /** * Get files * diff --git a/src/Http/Adapter/Swoole/Request.php b/src/Http/Adapter/Swoole/Request.php index 9e0ffa11..d93310d2 100644 --- a/src/Http/Adapter/Swoole/Request.php +++ b/src/Http/Adapter/Swoole/Request.php @@ -179,6 +179,33 @@ public function setURI(string $uri): static return $this; } + /** + * Get Query String + * + * Return HTTP request query string + * + * @return string + */ + public function getQueryString(): string + { + return $this->getServer('query_string') ?? ''; + } + + /** + * Set Query String + * + * Set HTTP request query string + * + * @param string $value + * @return static + */ + public function setQueryString(string $value): static + { + $this->setServer('query_string', $value); + + return $this; + } + /** * Get Referer * diff --git a/src/Http/Exception.php b/src/Http/Exception.php index 46e55958..4de36cc3 100644 --- a/src/Http/Exception.php +++ b/src/Http/Exception.php @@ -2,6 +2,8 @@ namespace Utopia\Http; -class Exception extends \Exception +use Utopia\Servers\Exception as ServersException; + +class Exception extends ServersException { } diff --git a/src/Http/Hook.php b/src/Http/Hook.php index 6519744e..e83a4f88 100644 --- a/src/Http/Hook.php +++ b/src/Http/Hook.php @@ -2,253 +2,8 @@ namespace Utopia\Http; -use Utopia\DI\Injection; +use Utopia\Servers\Hook as ServersHook; -class Hook extends Injection +class Hook extends ServersHook { - /** - * Description - * - * @var string - */ - protected string $desc = ''; - - /** - * Parameters - * - * List of route params names and validators - * - * @var array - */ - protected array $params = []; - - /** - * Group - * - * @var array - */ - protected array $groups = []; - - /** - * Labels - * - * List of route label names - * - * @var array - */ - protected array $labels = []; - - /** - * Injections - * - * List of route required injections for action callback - * - * @var array - */ - protected array $injections = []; - - /** - * Add Description - * - * @param string $desc - * @return static - */ - public function desc(string $desc): static - { - $this->desc = $desc; - - return $this; - } - - /** - * Get Description - * - * @return string - */ - public function getDesc(): string - { - return $this->desc; - } - - /** - * Add Group - * - * @param array $groups - * @return static - */ - public function groups(array $groups): static - { - $this->groups = $groups; - - return $this; - } - - /** - * Get Groups - * - * @return array - */ - public function getGroups(): array - { - return $this->groups; - } - - /** - * Add Label - * - * @param string $key - * @param mixed $value - * @return $this - */ - public function label(string $key, mixed $value): static - { - $this->labels[$key] = $value; - - return $this; - } - - /** - * Get Label - * - * Return given label value or default value if label doesn't exists - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function getLabel(string $key, mixed $default): mixed - { - return (isset($this->labels[$key])) ? $this->labels[$key] : $default; - } - - /** - * Add Action - * - * @param callable $action - * @return static - */ - public function action(callable $action): static - { - $this->setCallback($action); - - return $this; - } - - /** - * Get Action - * - * @return callable - */ - public function getAction() - { - return $this->getCallback(); - } - - /** - * Depenedency - * - * @param string $name - * @return self - * - * @throws Exception - */ - public function inject(string $name): self - { - parent::inject($name); - - return $this; - } - - /** - * Add Param - * - * @param string $key - * @param mixed $default - * @param Validator|callable $validator - * @param string $description - * @param bool $optional - * @param array $injections - * @param bool $skipValidation - * @return static - */ - public function param(string $key, mixed $default, Validator|callable $validator, string $description = '', bool $optional = false, array $injections = [], bool $skipValidation = false): static - { - $this->params[$key] = [ - 'default' => $default, - 'validator' => $validator, - 'description' => $description, - 'optional' => $optional, - 'injections' => $injections, - 'skipValidation' => $skipValidation, - 'value' => null, - 'order' => count($this->params) + count($this->injections), - ]; - - $this->inject($key); - - return $this; - } - - /** - * Get Params - * - * @return array - */ - public function getParams(): array - { - return $this->params; - } - - /** - * Get Param Values - * - * @return array - */ - public function getParamsValues(): array - { - $values = []; - - foreach ($this->params as $key => $param) { - $values[$key] = $param['value']; - } - - return $values; - } - - /** - * Set Param Value - * - * @param string $key - * @param mixed $value - * @return static - * - * @throws Exception - */ - public function setParamValue(string $key, mixed $value): static - { - if (!isset($this->params[$key])) { - throw new Exception('Unknown key'); - } - - $this->params[$key]['value'] = $value; - - return $this; - } - - /** - * Get Param Value - * - * @param string $key - * @return mixed - * - * @throws Exception - */ - public function getParamValue(string $key): mixed - { - if (!isset($this->params[$key])) { - throw new Exception('Unknown key'); - } - - return $this->params[$key]['value']; - } } diff --git a/src/Http/Http.php b/src/Http/Http.php index 73fe8d85..00569b20 100755 --- a/src/Http/Http.php +++ b/src/Http/Http.php @@ -4,8 +4,9 @@ use Utopia\DI\Container; use Utopia\DI\Dependency; +use Utopia\Servers\Base; -class Http +class Http extends Base { /** * Request method constants @@ -18,52 +19,11 @@ class Http public const REQUEST_METHOD_OPTIONS = 'OPTIONS'; public const REQUEST_METHOD_HEAD = 'HEAD'; - /** - * Mode Type - */ - public const MODE_TYPE_DEVELOPMENT = 'development'; - public const MODE_TYPE_STAGE = 'stage'; - public const MODE_TYPE_PRODUCTION = 'production'; - /** * @var Files */ protected Files $files; - /** - * Current running mode - * - * @var string - */ - protected static string $mode = ''; - - /** - * Errors - * - * Errors callbacks - * - * @var Hook[] - */ - protected static array $errors = []; - - /** - * Init - * - * A callback function that is initialized on application start - * - * @var Hook[] - */ - protected static array $init = []; - - /** - * Shutdown - * - * A callback function that is initialized on application end - * - * @var Hook[] - */ - protected static array $shutdown = []; - /** * Options * @@ -73,22 +33,6 @@ class Http */ protected static array $options = []; - /** - * Server Start hooks - * - * @var Hook[] - */ - protected static array $startHooks = []; - - /** - * Route - * - * Memory cached result for chosen route - * - * @var Route|null - */ - protected ?Route $route = null; - /** * Wildcard route * If set, this get's executed if no other route is matched @@ -102,11 +46,6 @@ class Http */ protected Adapter $server; - /** - * @var Container - */ - protected Container $container; - protected string|null $requestClass = null; protected string|null $responseClass = null; @@ -221,40 +160,6 @@ public static function wildcard(): Route return $route; } - /** - * Init - * - * Set a callback function that will be initialized on application start - * - * @return Hook - */ - public static function init(): Hook - { - $hook = new Hook(); - $hook->groups(['*']); - - self::$init[] = $hook; - - return $hook; - } - - /** - * Shutdown - * - * Set a callback function that will be initialized on application end - * - * @return Hook - */ - public static function shutdown(): Hook - { - $hook = new Hook(); - $hook->groups(['*']); - - self::$shutdown[] = $hook; - - return $hook; - } - /** * Options * @@ -272,23 +177,6 @@ public static function options(): Hook return $hook; } - /** - * Error - * - * An error callback for failed or no matched requests - * - * @return Hook - */ - public static function error(): Hook - { - $hook = new Hook(); - $hook->groups(['*']); - - self::$errors[] = $hook; - - return $hook; - } - /** * Get Mode * @@ -314,24 +202,6 @@ public static function setMode(string $value): void self::$mode = $value; } - /** - * Get Container - * - * @return Container - */ - public function getContainer(): Container - { - return $this->container; - } - - /** - * Set Container - */ - public function setContainer(Container $container): void - { - $this->container = $container; - } - /** * Get allow override * @@ -355,36 +225,6 @@ public static function setAllowOverride(bool $value): void Router::setAllowOverride($value); } - /** - * Is http in production mode? - * - * @return bool - */ - public static function isProduction(): bool - { - return self::MODE_TYPE_PRODUCTION === self::$mode; - } - - /** - * Is http in development mode? - * - * @return bool - */ - public static function isDevelopment(): bool - { - return self::MODE_TYPE_DEVELOPMENT === self::$mode; - } - - /** - * Is http in stage mode? - * - * @return bool - */ - public static function isStage(): bool - { - return self::MODE_TYPE_STAGE === self::$mode; - } - /** * Add Route * @@ -454,13 +294,6 @@ protected function getFileMimeType(string $uri): mixed return $this->files->getFileMimeType($uri); } - public static function onStart(): Hook - { - $hook = new Hook(); - self::$startHooks[] = $hook; - return $hook; - } - public function start() { $this->server->onRequest(function ($request, $response) { @@ -505,7 +338,7 @@ public function start() ; try { - foreach (self::$startHooks as $hook) { + foreach (self::$start as $hook) { $this->prepare($container, $hook, [], [])->inject($hook, true); } } catch(\Exception $e) { @@ -632,53 +465,6 @@ protected function lifecycle(Route $route, Request $request, Container $context) return $this; } - /** - * Prepare hook for injection, add dependencies, run validation. - * - * @param Hook $hook - * @param array $values - * @param array $requestParams - * @return Container - * - * @throws Exception - */ - protected function prepare(Container $context, Hook $hook, array $values = [], array $requestParams = []): Container - { - foreach ($hook->getParams() as $key => $param) { // Get value from route or request object - $existsInRequest = \array_key_exists($key, $requestParams); - $existsInValues = \array_key_exists($key, $values); - $paramExists = $existsInRequest || $existsInValues; - $arg = $existsInRequest ? $requestParams[$key] : $param['default']; - - $value = $existsInValues ? $values[$key] : $arg; - - /** - * Validation - */ - if (!$param['skipValidation']) { - if (!$paramExists && !$param['optional']) { - throw new Exception('Param "' . $key . '" is not optional.', 400); - } - - if ($paramExists) { - $this->validate($key, $param, $value, $context); - } - } - - $hook->setParamValue($key, $value); - - $dependencyForValue = new Dependency(); - $dependencyForValue - ->setName($key) - ->setCallback(fn () => $value) - ; - - $context->set($dependencyForValue); - } - - return $context; - } - /** * Run * @@ -813,50 +599,6 @@ public function run(Container $context): static return $this; } - /** - * Validate Param - * - * Creates an validator instance and validate given value with given rules. - * - * @param string $key - * @param array $param - * @param mixed $value - * @return void - * - * @throws Exception - */ - protected function validate(string $key, array $param, mixed $value, Container $context): void - { - if ($param['optional'] && \is_null($value)) { - return; - } - - $validator = $param['validator']; // checking whether the class exists - - if (\is_callable($validator)) { - - $dependency = new Dependency(); - $dependency - ->setName('_validator:'.$key) - ->setCallback($param['validator']) - ; - - foreach ($param['injections'] as $injection) { - $dependency->inject($injection); - } - - $validator = $context->inject($dependency); - } - - if (!$validator instanceof Validator) { // is the validator object an instance of the Validator class - throw new Exception('Validator object is not an instance of the Validator class', 500); - } - - if (!$validator->isValid($value)) { - throw new Exception('Invalid `' . $key . '` param: ' . $validator->getDescription(), 400); - } - } - /** * Reset all the static variables * @@ -865,11 +607,7 @@ protected function validate(string $key, array $param, mixed $value, Container $ public static function reset(): void { Router::reset(); - self::$mode = ''; - self::$errors = []; - self::$init = []; - self::$shutdown = []; self::$options = []; - self::$startHooks = []; + parent::reset(); } } diff --git a/src/Http/Request.php b/src/Http/Request.php index 65f67b28..e8894e04 100755 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -90,6 +90,19 @@ public function getQuery(string $key, mixed $default = null): mixed return $this->queryString[$key] ?? $default; } + /** + * Set query string parameters + * + * @param array $params + * @return static + */ + public function setQuery(array $params): static + { + $this->queryString = $params; + + return $this; + } + /** * Get payload * @@ -203,10 +216,7 @@ abstract public function setMethod(string $method): static; * * @return string */ - public function getURI(): string - { - return $this->getServer('REQUEST_URI') ?? ''; - } + abstract public function getURI(): string; /** * Get Path @@ -218,6 +228,25 @@ public function getURI(): string */ abstract public function setURI(string $uri): static; + /** + * Get query string + * + * Method for querying HTTP GET request query string + * + * @return string + */ + abstract public function getQueryString(): string; + + /** + * Set query string + * + * Method for setting HTTP GET request query string + * + * @param string $value + * @return static + */ + abstract public function setQueryString(string $value): static; + /** * Get files * @@ -454,18 +483,6 @@ public function getRangeUnit(): ?string return null; } - /** - * Set query string parameters - * - * @param array $params - * @return static - */ - public function setQueryString(array $params): static - { - $this->queryString = $params; - - return $this; - } /** * Set payload parameters diff --git a/src/Http/Validator.php b/src/Http/Validator.php index 6a8304ea..f75b1550 100755 --- a/src/Http/Validator.php +++ b/src/Http/Validator.php @@ -2,7 +2,9 @@ namespace Utopia\Http; -abstract class Validator +use Utopia\Servers\Validator as ServersValidator; + +abstract class Validator extends ServersValidator { public const TYPE_BOOLEAN = 'boolean'; @@ -17,41 +19,4 @@ abstract class Validator public const TYPE_OBJECT = 'object'; public const TYPE_MIXED = 'mixed'; - - /** - * Get Description - * - * Returns validator description - * - * @return string - */ - abstract public function getDescription(): string; - - /** - * Is array - * - * Returns true if an array or false if not. - * - * @return bool - */ - abstract public function isArray(): bool; - - /** - * Is valid - * - * Returns true if valid or false if not. - * - * @param mixed $value - * @return bool - */ - abstract public function isValid($value): bool; - - /** - * Get Type - * - * Returns validator type. - * - * @return string - */ - abstract public function getType(): string; } diff --git a/tests/RequestTest.php b/tests/RequestTest.php index 55d49ee9..6138ae78 100755 --- a/tests/RequestTest.php +++ b/tests/RequestTest.php @@ -65,9 +65,9 @@ public function testCanGetQueryParameter() $this->assertEquals($this->request->getQuery('unknown', 'test'), 'test'); } - public function testCanSetQueryString() + public function testCanSetQuery() { - $this->request->setQueryString(['key' => 'value']); + $this->request->setQuery(['key' => 'value']); $this->assertEquals($this->request->getQuery('key'), 'value'); $this->assertEquals($this->request->getQuery('unknown', 'test'), 'test'); @@ -156,6 +156,22 @@ public function testCanSetUri() $this->assertEquals('/page.html', $this->request->getURI()); } + public function testCanGetQueryString() + { + $this->assertEquals('', $this->request->getQueryString()); + + $_SERVER['QUERY_STRING'] = 'text=hello&value=key'; + + $this->assertEquals('text=hello&value=key', $this->request->getQueryString()); + } + + public function testCanSetQueryString() + { + $this->request->setURI('text=hello&value=key'); + + $this->assertEquals('text=hello&value=key', $this->request->getURI()); + } + public function testCanGetPort() { $_SERVER['HTTP_HOST'] = 'localhost:8080';