diff --git a/README.md b/README.md index efb569d..b802a61 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ if (file_exists(__DIR__.'/../vendor/autoload.php')) { require __DIR__.'/../vendor/autoload.php'; } -use Utopia\App; +use Utopia\Http; use Utopia\Swoole\Request; use Utopia\Swoole\Response; use Utopia\Swoole\Files; diff --git a/composer.json b/composer.json index 4684dbe..f90ca68 100755 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "require": { "php": ">=8.1", "ext-swoole": "6.*", - "utopia-php/framework": "0.33.37" + "utopia-php/framework": "0.33.*" }, "require-dev": { "phpunit/phpunit": "^9.3", diff --git a/composer.lock b/composer.lock index 06d8292..a1db6ad 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "608e2d54930906f4c843b8acd02ca667", + "content-hash": "3716c2d56574c0764e74d377e97ef7e2", "packages": [ { "name": "brick/math", - "version": "0.14.1", + "version": "0.14.5", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "f05858549e5f9d7bb45875a75583240a38a281d0" + "reference": "618a8077b3c326045e10d5788ed713b341fcfe40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/f05858549e5f9d7bb45875a75583240a38a281d0", - "reference": "f05858549e5f9d7bb45875a75583240a38a281d0", + "url": "https://api.github.com/repos/brick/math/zipball/618a8077b3c326045e10d5788ed713b341fcfe40", + "reference": "618a8077b3c326045e10d5788ed713b341fcfe40", "shasum": "" }, "require": { @@ -56,7 +56,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.14.1" + "source": "https://github.com/brick/math/tree/0.14.5" }, "funding": [ { @@ -64,7 +64,7 @@ "type": "github" } ], - "time": "2025-11-24T14:40:29+00:00" + "time": "2026-02-03T18:06:51+00:00" }, { "name": "composer/semver", @@ -146,16 +146,16 @@ }, { "name": "google/protobuf", - "version": "v4.33.4", + "version": "v4.33.5", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "22d28025cda0d223a2e48c2e16c5284ecc9f5402" + "reference": "ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/22d28025cda0d223a2e48c2e16c5284ecc9f5402", - "reference": "22d28025cda0d223a2e48c2e16c5284ecc9f5402", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d", + "reference": "ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d", "shasum": "" }, "require": { @@ -184,9 +184,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.4" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.5" }, - "time": "2026-01-12T17:58:43+00:00" + "time": "2026-01-29T20:49:00+00:00" }, { "name": "nyholm/psr7", @@ -339,12 +339,12 @@ "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "45bda7efa8fcdd9bdb0daa2f26c8e31f062f49d4" + "reference": "df5197c6fd0ddd8e9883b87de042d9341300e2ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/45bda7efa8fcdd9bdb0daa2f26c8e31f062f49d4", - "reference": "45bda7efa8fcdd9bdb0daa2f26c8e31f062f49d4", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/df5197c6fd0ddd8e9883b87de042d9341300e2ad", + "reference": "df5197c6fd0ddd8e9883b87de042d9341300e2ad", "shasum": "" }, "require": { @@ -354,7 +354,7 @@ "symfony/polyfill-php82": "^1.26" }, "conflict": { - "open-telemetry/sdk": "<=1.0.8" + "open-telemetry/sdk": "<=1.11" }, "default-branch": true, "type": "library", @@ -402,7 +402,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-10-19T10:49:48+00:00" + "time": "2026-01-21T04:14:03+00:00" }, { "name": "open-telemetry/context", @@ -465,16 +465,16 @@ }, { "name": "open-telemetry/exporter-otlp", - "version": "1.3.3", + "version": "1.3.4", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/exporter-otlp.git", - "reference": "07b02bc71838463f6edcc78d3485c04b48fb263d" + "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/07b02bc71838463f6edcc78d3485c04b48fb263d", - "reference": "07b02bc71838463f6edcc78d3485c04b48fb263d", + "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/62e680d587beb42e5247aa6ecd89ad1ca406e8ca", + "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca", "shasum": "" }, "require": { @@ -525,7 +525,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-11-13T08:04:37+00:00" + "time": "2026-01-15T09:31:34+00:00" }, { "name": "open-telemetry/gen-otlp-protobuf", @@ -593,16 +593,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.10.0", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "3dfc3d1ad729ec7eb25f1b9a4ae39fe779affa99" + "reference": "c76f91203bf7ef98ab3f4e0a82ca21699af185e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/3dfc3d1ad729ec7eb25f1b9a4ae39fe779affa99", - "reference": "3dfc3d1ad729ec7eb25f1b9a4ae39fe779affa99", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/c76f91203bf7ef98ab3f4e0a82ca21699af185e1", + "reference": "c76f91203bf7ef98ab3f4e0a82ca21699af185e1", "shasum": "" }, "require": { @@ -628,6 +628,7 @@ "ext-mbstring": "To increase performance of string operations", "open-telemetry/sdk-configuration": "File-based OpenTelemetry SDK configuration" }, + "default-branch": true, "type": "library", "extra": { "spi": { @@ -643,7 +644,7 @@ ] }, "branch-alias": { - "dev-main": "1.9.x-dev" + "dev-main": "1.12.x-dev" } }, "autoload": { @@ -686,7 +687,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-11-25T10:59:15+00:00" + "time": "2026-01-28T11:38:11+00:00" }, { "name": "open-telemetry/sem-conv", @@ -694,12 +695,12 @@ "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sem-conv.git", - "reference": "817db5ac5f5bfac74d907fdea1d977e7b123435f" + "reference": "e613bc640a407def4991b8a936a9b27edd9a3240" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/817db5ac5f5bfac74d907fdea1d977e7b123435f", - "reference": "817db5ac5f5bfac74d907fdea1d977e7b123435f", + "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/e613bc640a407def4991b8a936a9b27edd9a3240", + "reference": "e613bc640a407def4991b8a936a9b27edd9a3240", "shasum": "" }, "require": { @@ -744,7 +745,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-11-06T08:31:43+00:00" + "time": "2026-01-21T04:14:03+00:00" }, { "name": "php-http/discovery", @@ -1326,12 +1327,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "c805ba22435bbfb3c03f03ffc9138d98c70f407c" + "reference": "4d420d63f9371d000def506a86d6c771d99b480a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/c805ba22435bbfb3c03f03ffc9138d98c70f407c", - "reference": "c805ba22435bbfb3c03f03ffc9138d98c70f407c", + "url": "https://api.github.com/repos/symfony/http-client/zipball/4d420d63f9371d000def506a86d6c771d99b480a", + "reference": "4d420d63f9371d000def506a86d6c771d99b480a", "shasum": "" }, "require": { @@ -1419,7 +1420,7 @@ "type": "tidelift" } ], - "time": "2026-01-14T09:36:49+00:00" + "time": "2026-01-29T08:55:18+00:00" }, { "name": "symfony/http-client-contracts", @@ -1427,12 +1428,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "e0a626f4c4be5102fda6f2a8ff2b14cf71516fe0" + "reference": "402a972e29ca7f0596dcbe072b8d2c1ff9f2dd78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/e0a626f4c4be5102fda6f2a8ff2b14cf71516fe0", - "reference": "e0a626f4c4be5102fda6f2a8ff2b14cf71516fe0", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/402a972e29ca7f0596dcbe072b8d2c1ff9f2dd78", + "reference": "402a972e29ca7f0596dcbe072b8d2c1ff9f2dd78", "shasum": "" }, "require": { @@ -1502,7 +1503,7 @@ "type": "tidelift" } ], - "time": "2026-01-05T13:30:16+00:00" + "time": "2026-01-29T09:42:44+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -1846,12 +1847,12 @@ "source": { "type": "git", "url": "https://github.com/Nevay/spi.git", - "reference": "e7078767866d0a9e0f91d3f9d42a832df5e39002" + "reference": "745651244b572054f3c3c52803c6189ddf07fe17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Nevay/spi/zipball/e7078767866d0a9e0f91d3f9d42a832df5e39002", - "reference": "e7078767866d0a9e0f91d3f9d42a832df5e39002", + "url": "https://api.github.com/repos/Nevay/spi/zipball/745651244b572054f3c3c52803c6189ddf07fe17", + "reference": "745651244b572054f3c3c52803c6189ddf07fe17", "shasum": "" }, "require": { @@ -1889,9 +1890,9 @@ ], "support": { "issues": "https://github.com/Nevay/spi/issues", - "source": "https://github.com/Nevay/spi/tree/v1.0.5" + "source": "https://github.com/Nevay/spi/tree/main" }, - "time": "2025-06-29T15:42:06+00:00" + "time": "2026-01-22T16:06:30+00:00" }, { "name": "utopia-php/compression", @@ -1941,22 +1942,22 @@ }, { "name": "utopia-php/framework", - "version": "0.33.37", + "version": "0.33.x-dev", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "30a119d76531d89da9240496940c84fcd9e1758b" + "reference": "decfa49d60d99e922de364c49169b396fafd5ab8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/30a119d76531d89da9240496940c84fcd9e1758b", - "reference": "30a119d76531d89da9240496940c84fcd9e1758b", + "url": "https://api.github.com/repos/utopia-php/http/zipball/decfa49d60d99e922de364c49169b396fafd5ab8", + "reference": "decfa49d60d99e922de364c49169b396fafd5ab8", "shasum": "" }, "require": { "php": ">=8.3", "utopia-php/compression": "0.1.*", - "utopia-php/telemetry": "0.1.*", + "utopia-php/telemetry": "0.2.*", "utopia-php/validators": "0.2.*" }, "require-dev": { @@ -1983,38 +1984,43 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.37" + "source": "https://github.com/utopia-php/http/tree/0.33.x" }, - "time": "2026-01-13T10:10:21+00:00" + "time": "2026-02-04T04:59:25+00:00" }, { "name": "utopia-php/telemetry", - "version": "0.1.1", + "version": "0.2.0", "source": { "type": "git", "url": "https://github.com/utopia-php/telemetry.git", - "reference": "437f0021777f0e575dfb9e8a1a081b3aed75e33f" + "reference": "9997ebf59bb77920a7223ad73d834a76b09152c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/telemetry/zipball/437f0021777f0e575dfb9e8a1a081b3aed75e33f", - "reference": "437f0021777f0e575dfb9e8a1a081b3aed75e33f", + "url": "https://api.github.com/repos/utopia-php/telemetry/zipball/9997ebf59bb77920a7223ad73d834a76b09152c3", + "reference": "9997ebf59bb77920a7223ad73d834a76b09152c3", "shasum": "" }, "require": { "ext-opentelemetry": "*", "ext-protobuf": "*", - "nyholm/psr7": "^1.8", - "open-telemetry/exporter-otlp": "^1.1", - "open-telemetry/sdk": "^1.1", + "nyholm/psr7": "1.*", + "open-telemetry/exporter-otlp": "1.*", + "open-telemetry/sdk": "1.*", "php": ">=8.0", - "symfony/http-client": "^7.1" + "symfony/http-client": "7.*" }, "require-dev": { - "laravel/pint": "^1.2", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.5.25" + "laravel/pint": "1.*", + "phpbench/phpbench": "1.*", + "phpstan/phpstan": "2.*", + "phpunit/phpunit": "11.*", + "swoole/ide-helper": "6.*" + }, + "suggest": { + "ext-sockets": "Required for the Swoole transport implementation", + "ext-swoole": "Required for the Swoole transport implementation" }, "type": "library", "autoload": { @@ -2033,9 +2039,9 @@ ], "support": { "issues": "https://github.com/utopia-php/telemetry/issues", - "source": "https://github.com/utopia-php/telemetry/tree/0.1.1" + "source": "https://github.com/utopia-php/telemetry/tree/0.2.0" }, - "time": "2025-03-17T11:57:52+00:00" + "time": "2025-12-17T07:56:38+00:00" }, { "name": "utopia-php/validators", @@ -2270,7 +2276,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" + "source": "https://github.com/myclabs/DeepCopy/tree/1.x" }, "funding": [ { @@ -2848,12 +2854,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "8161f7e37a79ed9d9c00f444c8acc33d52eaca9c" + "reference": "f9f31a35f726beaab98d1efe3b640e9b40c80baf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8161f7e37a79ed9d9c00f444c8acc33d52eaca9c", - "reference": "8161f7e37a79ed9d9c00f444c8acc33d52eaca9c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f9f31a35f726beaab98d1efe3b640e9b40c80baf", + "reference": "f9f31a35f726beaab98d1efe3b640e9b40c80baf", "shasum": "" }, "require": { @@ -2875,7 +2881,7 @@ "phpunit/php-timer": "^5.0.3", "sebastian/cli-parser": "^1.0.2", "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.9", + "sebastian/comparator": "^4.0.10", "sebastian/diff": "^4.0.6", "sebastian/environment": "^5.1.5", "sebastian/exporter": "^4.0.8", @@ -2951,7 +2957,7 @@ "type": "tidelift" } ], - "time": "2026-01-13T15:05:17+00:00" + "time": "2026-02-01T08:24:05+00:00" }, { "name": "sebastian/cli-parser", @@ -3126,12 +3132,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5" + "reference": "e4df00b9b3571187db2831ae9aada2c6efbd715d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/67a2df3a62639eab2cc5906065e9805d4fd5dfc5", - "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e4df00b9b3571187db2831ae9aada2c6efbd715d", + "reference": "e4df00b9b3571187db2831ae9aada2c6efbd715d", "shasum": "" }, "require": { @@ -3184,7 +3190,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.9" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.10" }, "funding": [ { @@ -3204,7 +3210,7 @@ "type": "tidelift" } ], - "time": "2025-08-10T06:51:50+00:00" + "time": "2026-01-24T09:22:56+00:00" }, { "name": "sebastian/complexity", @@ -4054,9 +4060,9 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=8.0", + "php": ">=8.1", "ext-swoole": "6.*" }, "platform-dev": {}, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.6.0" } diff --git a/tests/e2e/server.php b/tests/e2e/server.php index ab86507..a57eefb 100644 --- a/tests/e2e/server.php +++ b/tests/e2e/server.php @@ -6,7 +6,7 @@ use Swoole\Http\Response as SwooleResponse; use Swoole\Http\Server; use Swoole\Process; -use Utopia\App; +use Utopia\Http; use Utopia\Swoole\Request; use Utopia\Swoole\Response; @@ -16,9 +16,9 @@ ini_set('display_socket_timeout', -1); error_reporting(E_ALL); -$http = new Server('0.0.0.0', App::getENV('PORT', '80')); +$http = new Server('0.0.0.0', Http::getENV('PORT', '80')); -$payloadSize = max('4000000'/* 4mb */, App::getEnv('_APP_STORAGE_LIMIT', '10000000'/* 10mb */)); +$payloadSize = max('4000000'/* 4mb */, Http::getEnv('_APP_STORAGE_LIMIT', '10000000'/* 10mb */)); $http ->set([ @@ -54,20 +54,20 @@ }); }); -App::get('/') +Http::get('/') ->inject('response') ->action(function ($response) { $response->send('Hello World!'); }); -App::get('/headers') +Http::get('/headers') ->inject('request') ->inject('response') ->action(function ($request, $response) { $response->json(['headers' => $request->getHeaders()]); }); -App::get('/set-cookie') +Http::get('/set-cookie') ->inject('request') ->inject('response') ->action(function (Request $request, Response $response) { @@ -76,7 +76,7 @@ $response->send('OK'); }); -App::get('/chunked') +Http::get('/chunked') ->inject('response') ->action(function ($response) { // /** @var Utopia/Swoole/Response $response */ @@ -85,14 +85,14 @@ } }); -App::get('/redirect') +Http::get('/redirect') ->inject('response') ->action(function ($response) { // /** @var Utopia/Swoole/Response $response */ $response->redirect('/'); }); -App::get('/protocol') +Http::get('/protocol') ->inject('request') ->inject('response') ->action(function ($request, $response) { @@ -101,7 +101,7 @@ $response->send($request->getProtocol()); }); -App::get('/cookie') +Http::get('/cookie') ->inject('response') ->action(function (Response $response) { $response->addCookie('new-cookie', 'session-secret', \time(), '/', 'domain.com', true, true, null); @@ -112,7 +112,7 @@ $request = new Request($swooleRequest); $response = new Response($swooleResponse); - $app = new App('UTC'); + $app = new Http('UTC'); try { $app->run($request, $response); @@ -122,7 +122,7 @@ echo '[Error] File: '.$th->getFile(); echo '[Error] Line: '.$th->getLine(); - if (App::isDevelopment()) { + if (Http::isDevelopment()) { $swooleResponse->end('error: '.$th->getMessage()); } else { $swooleResponse->end('500: Server Error');