diff --git a/api.yml b/api.yml index 3ea24b7..3717711 100644 --- a/api.yml +++ b/api.yml @@ -8,7 +8,7 @@ info: email: alex@morbo.ru license: name: MIT - version: 0.1.4 + version: 0.1.5 tags: - name: Instance description: Everything about Trassir instances diff --git a/composer.json b/composer.json index ebd2d54..9cadd66 100644 --- a/composer.json +++ b/composer.json @@ -5,9 +5,10 @@ "react/http": "^1.8", "symfony/console": "^6.2", "clue/reactphp-sqlite": "^1.5", - "alexmorbo/reactphp-router": "dev-master", "alexmorbo/trassir-php": "dev-master", - "symfony/yaml": "^6.2" + "symfony/yaml": "^6.2", + "tnapf/router": "^6.0", + "react/async": "^4.1" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 2afb9b1..9d09b8f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,54 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "feda0b1efdd1e5185847f88c207cd2b1", + "content-hash": "24c69bfa687d8018ae07efc3f6aa8a36", "packages": [ - { - "name": "alexmorbo/reactphp-router", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/alexmorbo/Router.git", - "reference": "402d99963bf35e9407ac8ed09eb618e68c35f79f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/alexmorbo/Router/zipball/402d99963bf35e9407ac8ed09eb618e68c35f79f", - "reference": "402d99963bf35e9407ac8ed09eb618e68c35f79f", - "shasum": "" - }, - "require": { - "httpsoft/http-response": "^1.0", - "php": ">=8.2", - "react/http": "^1.8.0" - }, - "default-branch": true, - "type": "library", - "autoload": { - "psr-4": { - "React\\Router\\Http\\": "./src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Snedeker", - "email": "not@fou.nd", - "homepage": "https://github.com/CommandString" - }, - { - "name": "Alex Morbo", - "email": "alex@morbo.ru" - } - ], - "support": { - "source": "https://github.com/alexmorbo/Router/tree/master" - }, - "time": "2023-02-08T10:18:09+00:00" - }, { "name": "alexmorbo/trassir-php", "version": "dev-master", @@ -229,16 +183,16 @@ }, { "name": "clue/reactphp-sqlite", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/clue/reactphp-sqlite.git", - "reference": "eff96570e096caaf7f7f93a9a1b67f247e1ddbeb" + "reference": "d670a6694e7c4ba327f4778c4f2fd499c3fb85fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/clue/reactphp-sqlite/zipball/eff96570e096caaf7f7f93a9a1b67f247e1ddbeb", - "reference": "eff96570e096caaf7f7f93a9a1b67f247e1ddbeb", + "url": "https://api.github.com/repos/clue/reactphp-sqlite/zipball/d670a6694e7c4ba327f4778c4f2fd499c3fb85fc", + "reference": "d670a6694e7c4ba327f4778c4f2fd499c3fb85fc", "shasum": "" }, "require": { @@ -247,10 +201,10 @@ "php": ">=5.4", "react/child-process": "^0.6", "react/event-loop": "^1.2", - "react/promise": "^2.7 || ^1.2.1" + "react/promise": "^3 || ^2.7 || ^1.2.1" }, "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" }, "type": "library", "autoload": { @@ -279,7 +233,7 @@ ], "support": { "issues": "https://github.com/clue/reactphp-sqlite/issues", - "source": "https://github.com/clue/reactphp-sqlite/tree/v1.5.0" + "source": "https://github.com/clue/reactphp-sqlite/tree/v1.6.0" }, "funding": [ { @@ -291,32 +245,68 @@ "type": "github" } ], - "time": "2022-02-15T08:04:18+00:00" + "time": "2023-05-12T12:33:20+00:00" + }, + { + "name": "commandstring/utils", + "version": "v1.7.2", + "source": { + "type": "git", + "url": "https://github.com/CommandString/Utils.git", + "reference": "b07ae426455c34ce654f266779a2f52bb9134432" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/CommandString/Utils/zipball/b07ae426455c34ce654f266779a2f52bb9134432", + "reference": "b07ae426455c34ce654f266779a2f52bb9134432", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^10", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "CommandString\\Utils\\": "src/", + "Tests\\CommandString\\Utils\\": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A collection of useful PHP utilities", + "support": { + "issues": "https://github.com/CommandString/Utils/issues", + "source": "https://github.com/CommandString/Utils/tree/v1.7.2" + }, + "time": "2023-05-01T18:29:10+00:00" }, { "name": "evenement/evenement", - "version": "v3.0.1", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/igorw/evenement.git", - "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7" + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7", - "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", "shasum": "" }, "require": { "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9 || ^6" }, "type": "library", "autoload": { - "psr-0": { - "Evenement": "src" + "psr-4": { + "Evenement\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -336,9 +326,9 @@ ], "support": { "issues": "https://github.com/igorw/evenement/issues", - "source": "https://github.com/igorw/evenement/tree/master" + "source": "https://github.com/igorw/evenement/tree/v3.0.2" }, - "time": "2017-07-23T21:35:13+00:00" + "time": "2023-08-08T05:53:35+00:00" }, { "name": "fig/http-message-util", @@ -396,34 +386,96 @@ }, "time": "2020-11-24T22:02:12+00:00" }, + { + "name": "httpsoft/http-emitter", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/httpsoft/http-emitter.git", + "reference": "b09e2834b6d40e022f0c0eb7417f97f496e376b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/httpsoft/http-emitter/zipball/b09e2834b6d40e022f0c0eb7417f97f496e376b6", + "reference": "b09e2834b6d40e022f0c0eb7417f97f496e376b6", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0", + "psr/http-message": "^1.1|^2.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "httpsoft/http-message": "^1.1", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.7", + "vimeo/psalm": "^4.9|^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "HttpSoft\\Emitter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Evgeniy Zyubin", + "email": "mail@devanych.ru", + "homepage": "https://devanych.ru/", + "role": "Founder and lead developer" + } + ], + "description": "Emitting of PSR-7 Response implementation", + "homepage": "https://httpsoft.org/", + "keywords": [ + "emitter", + "http", + "http-emitter", + "http-message", + "php", + "psr-7" + ], + "support": { + "docs": "https://httpsoft.org/docs/emitter", + "issues": "https://github.com/httpsoft/http-emitter/issues", + "source": "https://github.com/httpsoft/http-emitter" + }, + "time": "2023-05-05T20:18:44+00:00" + }, { "name": "httpsoft/http-message", - "version": "1.0.10", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/httpsoft/http-message.git", - "reference": "bb3f88feeb67061949339ee47a5e0b648f2d5c9a" + "reference": "6d86446b9d8f92cc06c60375d3e67cf3407a57a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/httpsoft/http-message/zipball/bb3f88feeb67061949339ee47a5e0b648f2d5c9a", - "reference": "bb3f88feeb67061949339ee47a5e0b648f2d5c9a", + "url": "https://api.github.com/repos/httpsoft/http-message/zipball/6d86446b9d8f92cc06c60375d3e67cf3407a57a5", + "reference": "6d86446b9d8f92cc06c60375d3e67cf3407a57a5", "shasum": "" }, "require": { "php": "^7.4|^8.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.1|^2.0" }, "provide": { "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { - "php-http/psr7-integration-tests": "1.1.1", + "php-http/psr7-integration-tests": "^1.3", "phpunit/phpunit": "^9.5", - "squizlabs/php_codesniffer": "^3.6", - "vimeo/psalm": "^4.8" + "squizlabs/php_codesniffer": "^3.7", + "vimeo/psalm": "^4.9|^5.2" }, "type": "library", "autoload": { @@ -457,24 +509,24 @@ "issues": "https://github.com/httpsoft/http-message/issues", "source": "https://github.com/httpsoft/http-message" }, - "time": "2022-07-21T15:28:12+00:00" + "time": "2023-05-06T16:34:44+00:00" }, { "name": "httpsoft/http-response", - "version": "1.0.4", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/httpsoft/http-response.git", - "reference": "997a934c6d0cc91166b05ced65639d82be585afb" + "reference": "6e9d25a540506ba8a5165817fdd856a856e32c02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/httpsoft/http-response/zipball/997a934c6d0cc91166b05ced65639d82be585afb", - "reference": "997a934c6d0cc91166b05ced65639d82be585afb", + "url": "https://api.github.com/repos/httpsoft/http-response/zipball/6e9d25a540506ba8a5165817fdd856a856e32c02", + "reference": "6e9d25a540506ba8a5165817fdd856a856e32c02", "shasum": "" }, "require": { - "httpsoft/http-message": "^1.0", + "httpsoft/http-message": "^1.1", "php": "^7.4|^8.0" }, "provide": { @@ -482,8 +534,8 @@ }, "require-dev": { "phpunit/phpunit": "^9.5", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.3" + "squizlabs/php_codesniffer": "^3.7", + "vimeo/psalm": "^4.9|^5.2" }, "type": "library", "autoload": { @@ -518,20 +570,80 @@ "issues": "https://github.com/httpsoft/http-response/issues", "source": "https://github.com/httpsoft/http-response" }, - "time": "2020-12-12T17:03:26+00:00" + "time": "2023-05-05T20:55:06+00:00" + }, + { + "name": "httpsoft/http-server-request", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/httpsoft/http-server-request.git", + "reference": "3d773c8bcaa1c44793d35842fcd82a9d5fd5f193" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/httpsoft/http-server-request/zipball/3d773c8bcaa1c44793d35842fcd82a9d5fd5f193", + "reference": "3d773c8bcaa1c44793d35842fcd82a9d5fd5f193", + "shasum": "" + }, + "require": { + "httpsoft/http-message": "^1.1", + "php": "^7.4|^8.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.7", + "vimeo/psalm": "^4.9|^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "HttpSoft\\ServerRequest\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Evgeniy Zyubin", + "email": "mail@devanych.ru", + "homepage": "https://devanych.ru/", + "role": "Founder and lead developer" + } + ], + "description": "Infrastructure for creating PSR-7 ServerRequest and UploadedFile", + "homepage": "https://httpsoft.org/", + "keywords": [ + "http", + "http-message", + "http-server-request", + "php", + "psr-7" + ], + "support": { + "docs": "https://httpsoft.org/docs/server-request", + "issues": "https://github.com/httpsoft/http-server-request/issues", + "source": "https://github.com/httpsoft/http-server-request" + }, + "time": "2023-05-05T19:55:05+00:00" }, { "name": "monolog/monolog", - "version": "3.3.1", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "9b5daeaffce5b926cac47923798bba91059e60e2" + "reference": "e2392369686d420ca32df3803de28b5d6f76867d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/9b5daeaffce5b926cac47923798bba91059e60e2", - "reference": "9b5daeaffce5b926cac47923798bba91059e60e2", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/e2392369686d420ca32df3803de28b5d6f76867d", + "reference": "e2392369686d420ca32df3803de28b5d6f76867d", "shasum": "" }, "require": { @@ -546,7 +658,7 @@ "doctrine/couchdb": "~1.0@dev", "elasticsearch/elasticsearch": "^7 || ^8", "ext-json": "*", - "graylog2/gelf-php": "^1.4.2 || ^2@dev", + "graylog2/gelf-php": "^1.4.2 || ^2.0", "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", @@ -554,7 +666,7 @@ "phpstan/phpstan": "^1.9", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-strict-rules": "^1.4", - "phpunit/phpunit": "^9.5.26", + "phpunit/phpunit": "^10.1", "predis/predis": "^1.1 || ^2", "ruflin/elastica": "^7", "symfony/mailer": "^5.4 || ^6", @@ -607,7 +719,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.3.1" + "source": "https://github.com/Seldaek/monolog/tree/3.4.0" }, "funding": [ { @@ -619,29 +731,33 @@ "type": "tidelift" } ], - "time": "2023-02-06T13:46:10+00:00" + "time": "2023-06-21T08:46:11+00:00" }, { "name": "nesbot/carbon", - "version": "2.66.0", + "version": "2.71.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "496712849902241f04902033b0441b269effe001" + "reference": "98276233188583f2ff845a0f992a235472d9466a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/496712849902241f04902033b0441b269effe001", - "reference": "496712849902241f04902033b0441b269effe001", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/98276233188583f2ff845a0f992a235472d9466a", + "reference": "98276233188583f2ff845a0f992a235472d9466a", "shasum": "" }, "require": { "ext-json": "*", "php": "^7.1.8 || ^8.0", + "psr/clock": "^1.0", "symfony/polyfill-mbstring": "^1.0", "symfony/polyfill-php80": "^1.16", "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, + "provide": { + "psr/clock-implementation": "1.0" + }, "require-dev": { "doctrine/dbal": "^2.0 || ^3.1.4", "doctrine/orm": "^2.7", @@ -721,7 +837,55 @@ "type": "tidelift" } ], - "time": "2023-01-29T18:53:47+00:00" + "time": "2023-09-25T11:31:05+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" }, { "name": "psr/container", @@ -778,21 +942,21 @@ }, { "name": "psr/http-factory", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + "reference": "e616d01114759c4c489f93b099585439f795fe35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", "shasum": "" }, "require": { "php": ">=7.0.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -812,7 +976,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for PSR-7 HTTP message factories", @@ -827,31 +991,31 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/master" + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" }, - "time": "2019-04-30T12:38:16+00:00" + "time": "2023-04-10T20:10:41+00:00" }, { "name": "psr/http-message", - "version": "1.0.1", + "version": "1.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -880,9 +1044,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" + "source": "https://github.com/php-fig/http-message/tree/1.1" }, - "time": "2016-08-06T14:39:51+00:00" + "time": "2023-04-04T09:50:52+00:00" }, { "name": "psr/log", @@ -934,6 +1098,81 @@ }, "time": "2021-07-14T16:46:02+00:00" }, + { + "name": "react/async", + "version": "v4.1.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/async.git", + "reference": "b9641ac600b4b144e71a87dcf1be4d41dd3a3548" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/async/zipball/b9641ac600b4b144e71a87dcf1be4d41dd3a3548", + "reference": "b9641ac600b4b144e71a87dcf1be4d41dd3a3548", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "react/event-loop": "^1.2", + "react/promise": "^3.0 || ^2.8 || ^1.2.1" + }, + "require-dev": { + "phpstan/phpstan": "1.10.18", + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Async\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async utilities and fibers for ReactPHP", + "keywords": [ + "async", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/async/issues", + "source": "https://github.com/reactphp/async/tree/v4.1.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-06-22T14:10:50+00:00" + }, { "name": "react/cache", "version": "v1.2.0", @@ -1087,33 +1326,33 @@ }, { "name": "react/dns", - "version": "v1.10.0", + "version": "v1.11.0", "source": { "type": "git", "url": "https://github.com/reactphp/dns.git", - "reference": "a5427e7dfa47713e438016905605819d101f238c" + "reference": "3be0fc8f1eb37d6875cd6f0c6c7d0be81435de9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/dns/zipball/a5427e7dfa47713e438016905605819d101f238c", - "reference": "a5427e7dfa47713e438016905605819d101f238c", + "url": "https://api.github.com/repos/reactphp/dns/zipball/3be0fc8f1eb37d6875cd6f0c6c7d0be81435de9f", + "reference": "3be0fc8f1eb37d6875cd6f0c6c7d0be81435de9f", "shasum": "" }, "require": { "php": ">=5.3.0", "react/cache": "^1.0 || ^0.6 || ^0.5", "react/event-loop": "^1.2", - "react/promise": "^3.0 || ^2.7 || ^1.2.1", - "react/promise-timer": "^1.9" + "react/promise": "^3.0 || ^2.7 || ^1.2.1" }, "require-dev": { - "phpunit/phpunit": "^9.3 || ^4.8.35", - "react/async": "^4 || ^3 || ^2" + "phpunit/phpunit": "^9.5 || ^4.8.35", + "react/async": "^4 || ^3 || ^2", + "react/promise-timer": "^1.9" }, "type": "library", "autoload": { "psr-4": { - "React\\Dns\\": "src" + "React\\Dns\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1151,49 +1390,43 @@ ], "support": { "issues": "https://github.com/reactphp/dns/issues", - "source": "https://github.com/reactphp/dns/tree/v1.10.0" + "source": "https://github.com/reactphp/dns/tree/v1.11.0" }, "funding": [ { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" + "url": "https://opencollective.com/reactphp", + "type": "open_collective" } ], - "time": "2022-09-08T12:22:46+00:00" + "time": "2023-06-02T12:45:26+00:00" }, { "name": "react/event-loop", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/reactphp/event-loop.git", - "reference": "187fb56f46d424afb6ec4ad089269c72eec2e137" + "reference": "6e7e587714fff7a83dcc7025aee42ab3b265ae05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/event-loop/zipball/187fb56f46d424afb6ec4ad089269c72eec2e137", - "reference": "187fb56f46d424afb6ec4ad089269c72eec2e137", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/6e7e587714fff7a83dcc7025aee42ab3b265ae05", + "reference": "6e7e587714fff7a83dcc7025aee42ab3b265ae05", "shasum": "" }, "require": { "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" }, "suggest": { - "ext-event": "~1.0 for ExtEventLoop", - "ext-pcntl": "For signal handling support when using the StreamSelectLoop", - "ext-uv": "* for ExtUvLoop" + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" }, "type": "library", "autoload": { "psr-4": { - "React\\EventLoop\\": "src" + "React\\EventLoop\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1229,32 +1462,28 @@ ], "support": { "issues": "https://github.com/reactphp/event-loop/issues", - "source": "https://github.com/reactphp/event-loop/tree/v1.3.0" + "source": "https://github.com/reactphp/event-loop/tree/v1.4.0" }, "funding": [ { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" + "url": "https://opencollective.com/reactphp", + "type": "open_collective" } ], - "time": "2022-03-17T11:10:22+00:00" + "time": "2023-05-05T10:11:24+00:00" }, { "name": "react/http", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/reactphp/http.git", - "reference": "aa7512ee17258c88466de30f9cb44ec5f9df3ff3" + "reference": "bb3154dbaf2dfe3f0467f956a05f614a69d5f1d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/http/zipball/aa7512ee17258c88466de30f9cb44ec5f9df3ff3", - "reference": "aa7512ee17258c88466de30f9cb44ec5f9df3ff3", + "url": "https://api.github.com/repos/reactphp/http/zipball/bb3154dbaf2dfe3f0467f956a05f614a69d5f1d0", + "reference": "bb3154dbaf2dfe3f0467f956a05f614a69d5f1d0", "shasum": "" }, "require": { @@ -1264,7 +1493,6 @@ "psr/http-message": "^1.0", "react/event-loop": "^1.2", "react/promise": "^3 || ^2.3 || ^1.2.1", - "react/promise-stream": "^1.4", "react/socket": "^1.12", "react/stream": "^1.2", "ringcentral/psr7": "^1.2" @@ -1273,14 +1501,15 @@ "clue/http-proxy-react": "^1.8", "clue/reactphp-ssh-proxy": "^1.4", "clue/socks-react": "^1.4", - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", "react/async": "^4 || ^3 || ^2", + "react/promise-stream": "^1.4", "react/promise-timer": "^1.9" }, "type": "library", "autoload": { "psr-4": { - "React\\Http\\": "src" + "React\\Http\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1325,39 +1554,36 @@ ], "support": { "issues": "https://github.com/reactphp/http/issues", - "source": "https://github.com/reactphp/http/tree/v1.8.0" + "source": "https://github.com/reactphp/http/tree/v1.9.0" }, "funding": [ { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" + "url": "https://opencollective.com/reactphp", + "type": "open_collective" } ], - "time": "2022-09-29T12:55:52+00:00" + "time": "2023-04-26T10:29:24+00:00" }, { "name": "react/promise", - "version": "v2.9.0", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/reactphp/promise.git", - "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910" + "reference": "c86753c76fd3be465d93b308f18d189f01a22be4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910", - "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910", + "url": "https://api.github.com/repos/reactphp/promise/zipball/c86753c76fd3be465d93b308f18d189f01a22be4", + "reference": "c86753c76fd3be465d93b308f18d189f01a22be4", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=7.1.0" }, "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" + "phpstan/phpstan": "1.10.20 || 1.4.10", + "phpunit/phpunit": "^9.5 || ^7.5" }, "type": "library", "autoload": { @@ -1401,213 +1627,43 @@ ], "support": { "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v2.9.0" - }, - "funding": [ - { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" - } - ], - "time": "2022-02-11T10:27:51+00:00" - }, - { - "name": "react/promise-stream", - "version": "v1.5.0", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise-stream.git", - "reference": "e6d2805e09ad50c4896f65f5e8705fe4ee7731a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise-stream/zipball/e6d2805e09ad50c4896f65f5e8705fe4ee7731a3", - "reference": "e6d2805e09ad50c4896f65f5e8705fe4ee7731a3", - "shasum": "" - }, - "require": { - "php": ">=5.3", - "react/promise": "^3 || ^2.1 || ^1.2", - "react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4.6" - }, - "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" - }, - "type": "library", - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "React\\Promise\\Stream\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" - }, - { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" - }, - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com", - "homepage": "https://sorgalla.com/" - }, - { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" - } - ], - "description": "The missing link between Promise-land and Stream-land for ReactPHP", - "homepage": "https://github.com/reactphp/promise-stream", - "keywords": [ - "Buffer", - "async", - "promise", - "reactphp", - "stream", - "unwrap" - ], - "support": { - "issues": "https://github.com/reactphp/promise-stream/issues", - "source": "https://github.com/reactphp/promise-stream/tree/v1.5.0" - }, - "funding": [ - { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" - } - ], - "time": "2022-09-09T11:42:18+00:00" - }, - { - "name": "react/promise-timer", - "version": "v1.9.0", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise-timer.git", - "reference": "aa7a73c74b8d8c0f622f5982ff7b0351bc29e495" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise-timer/zipball/aa7a73c74b8d8c0f622f5982ff7b0351bc29e495", - "reference": "aa7a73c74b8d8c0f622f5982ff7b0351bc29e495", - "shasum": "" - }, - "require": { - "php": ">=5.3", - "react/event-loop": "^1.2", - "react/promise": "^3.0 || ^2.7.0 || ^1.2.1" - }, - "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" - }, - "type": "library", - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "React\\Promise\\Timer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" - }, - { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" - }, - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com", - "homepage": "https://sorgalla.com/" - }, - { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" - } - ], - "description": "A trivial implementation of timeouts for Promises, built on top of ReactPHP.", - "homepage": "https://github.com/reactphp/promise-timer", - "keywords": [ - "async", - "event-loop", - "promise", - "reactphp", - "timeout", - "timer" - ], - "support": { - "issues": "https://github.com/reactphp/promise-timer/issues", - "source": "https://github.com/reactphp/promise-timer/tree/v1.9.0" + "source": "https://github.com/reactphp/promise/tree/v3.0.0" }, "funding": [ { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" + "url": "https://opencollective.com/reactphp", + "type": "open_collective" } ], - "time": "2022-06-13T13:41:03+00:00" + "time": "2023-07-11T16:12:49+00:00" }, { "name": "react/socket", - "version": "v1.12.0", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/reactphp/socket.git", - "reference": "81e1b4d7f5450ebd8d2e9a95bb008bb15ca95a7b" + "reference": "21591111d3ea62e31f2254280ca0656bc2b1bda6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/socket/zipball/81e1b4d7f5450ebd8d2e9a95bb008bb15ca95a7b", - "reference": "81e1b4d7f5450ebd8d2e9a95bb008bb15ca95a7b", + "url": "https://api.github.com/repos/reactphp/socket/zipball/21591111d3ea62e31f2254280ca0656bc2b1bda6", + "reference": "21591111d3ea62e31f2254280ca0656bc2b1bda6", "shasum": "" }, "require": { "evenement/evenement": "^3.0 || ^2.0 || ^1.0", "php": ">=5.3.0", - "react/dns": "^1.8", + "react/dns": "^1.11", "react/event-loop": "^1.2", "react/promise": "^3 || ^2.6 || ^1.2.1", - "react/promise-timer": "^1.9", "react/stream": "^1.2" }, "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", "react/async": "^4 || ^3 || ^2", - "react/promise-stream": "^1.4" + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.10" }, "type": "library", "autoload": { @@ -1651,32 +1707,28 @@ ], "support": { "issues": "https://github.com/reactphp/socket/issues", - "source": "https://github.com/reactphp/socket/tree/v1.12.0" + "source": "https://github.com/reactphp/socket/tree/v1.14.0" }, "funding": [ { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" + "url": "https://opencollective.com/reactphp", + "type": "open_collective" } ], - "time": "2022-08-25T12:32:25+00:00" + "time": "2023-08-25T13:48:09+00:00" }, { "name": "react/stream", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/reactphp/stream.git", - "reference": "7a423506ee1903e89f1e08ec5f0ed430ff784ae9" + "reference": "6fbc9672905c7d5a885f2da2fc696f65840f4a66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/stream/zipball/7a423506ee1903e89f1e08ec5f0ed430ff784ae9", - "reference": "7a423506ee1903e89f1e08ec5f0ed430ff784ae9", + "url": "https://api.github.com/repos/reactphp/stream/zipball/6fbc9672905c7d5a885f2da2fc696f65840f4a66", + "reference": "6fbc9672905c7d5a885f2da2fc696f65840f4a66", "shasum": "" }, "require": { @@ -1686,12 +1738,12 @@ }, "require-dev": { "clue/stream-filter": "~1.2", - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" }, "type": "library", "autoload": { "psr-4": { - "React\\Stream\\": "src" + "React\\Stream\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1733,19 +1785,15 @@ ], "support": { "issues": "https://github.com/reactphp/stream/issues", - "source": "https://github.com/reactphp/stream/tree/v1.2.0" + "source": "https://github.com/reactphp/stream/tree/v1.3.0" }, "funding": [ { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" + "url": "https://opencollective.com/reactphp", + "type": "open_collective" } ], - "time": "2021-07-11T12:37:55+00:00" + "time": "2023-06-16T10:52:11+00:00" }, { "name": "ringcentral/psr7", @@ -1810,23 +1858,23 @@ }, { "name": "symfony/console", - "version": "v6.2.5", + "version": "v6.3.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3e294254f2191762c1d137aed4b94e966965e985" + "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3e294254f2191762c1d137aed4b94e966965e985", - "reference": "3e294254f2191762c1d137aed4b94e966965e985", + "url": "https://api.github.com/repos/symfony/console/zipball/eca495f2ee845130855ddf1cf18460c38966c8b6", + "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/string": "^5.4|^6.0" }, "conflict": { @@ -1848,12 +1896,6 @@ "symfony/process": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, "type": "library", "autoload": { "psr-4": { @@ -1881,12 +1923,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.5" + "source": "https://github.com/symfony/console/tree/v6.3.4" }, "funding": [ { @@ -1902,20 +1944,20 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:38:09+00:00" + "time": "2023-08-16T10:10:12+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.0", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { @@ -1924,7 +1966,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -1953,7 +1995,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.2.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -1969,20 +2011,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { @@ -1997,7 +2039,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2035,7 +2077,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -2051,20 +2093,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + "reference": "875e90aeea2777b6f135677f618529449334a612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", + "reference": "875e90aeea2777b6f135677f618529449334a612", "shasum": "" }, "require": { @@ -2076,7 +2118,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2116,7 +2158,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" }, "funding": [ { @@ -2132,20 +2174,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", "shasum": "" }, "require": { @@ -2157,7 +2199,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2200,7 +2242,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" }, "funding": [ { @@ -2216,20 +2258,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -2244,7 +2286,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2283,7 +2325,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -2299,20 +2341,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -2321,7 +2363,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2366,7 +2408,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -2382,20 +2424,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.2.0", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75" + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/aac98028c69df04ee77eb69b96b86ee51fbf4b75", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", "shasum": "" }, "require": { @@ -2405,13 +2447,10 @@ "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -2451,7 +2490,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" }, "funding": [ { @@ -2467,20 +2506,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/string", - "version": "v6.2.5", + "version": "v6.3.5", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0" + "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0", - "reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0", + "url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339", + "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339", "shasum": "" }, "require": { @@ -2491,13 +2530,13 @@ "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", "symfony/intl": "^6.2", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", @@ -2537,7 +2576,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.5" + "source": "https://github.com/symfony/string/tree/v6.3.5" }, "funding": [ { @@ -2553,32 +2592,35 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:38:09+00:00" + "time": "2023-09-18T10:38:32+00:00" }, { "name": "symfony/translation", - "version": "v6.2.5", + "version": "v6.3.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "60556925a703cfbc1581cde3b3f35b0bb0ea904c" + "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/60556925a703cfbc1581cde3b3f35b0bb0ea904c", - "reference": "60556925a703cfbc1581cde3b3f35b0bb0ea904c", + "url": "https://api.github.com/repos/symfony/translation/zipball/3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", + "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", "shasum": "" }, "require": { "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.3|^3.0" + "symfony/translation-contracts": "^2.5|^3.0" }, "conflict": { "symfony/config": "<5.4", "symfony/console": "<5.4", "symfony/dependency-injection": "<5.4", + "symfony/http-client-contracts": "<2.5", "symfony/http-kernel": "<5.4", + "symfony/service-contracts": "<2.5", "symfony/twig-bundle": "<5.4", "symfony/yaml": "<5.4" }, @@ -2592,20 +2634,14 @@ "symfony/console": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", - "symfony/http-client-contracts": "^1.1|^2.0|^3.0", + "symfony/http-client-contracts": "^2.5|^3.0", "symfony/http-kernel": "^5.4|^6.0", "symfony/intl": "^5.4|^6.0", "symfony/polyfill-intl-icu": "^1.21", "symfony/routing": "^5.4|^6.0", - "symfony/service-contracts": "^1.1.2|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/yaml": "^5.4|^6.0" }, - "suggest": { - "nikic/php-parser": "To use PhpAstExtractor", - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, "type": "library", "autoload": { "files": [ @@ -2635,7 +2671,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.2.5" + "source": "https://github.com/symfony/translation/tree/v6.3.3" }, "funding": [ { @@ -2651,32 +2687,29 @@ "type": "tidelift" } ], - "time": "2023-01-05T07:00:27+00:00" + "time": "2023-07-31T07:08:24+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.2.0", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "68cce71402305a015f8c1589bfada1280dc64fe7" + "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/68cce71402305a015f8c1589bfada1280dc64fe7", - "reference": "68cce71402305a015f8c1589bfada1280dc64fe7", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/02c24deb352fb0d79db5486c0c79905a85e37e86", + "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86", "shasum": "" }, "require": { "php": ">=8.1" }, - "suggest": { - "symfony/translation-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -2716,7 +2749,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/translation-contracts/tree/v3.3.0" }, "funding": [ { @@ -2732,24 +2765,25 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-05-30T17:17:10+00:00" }, { "name": "symfony/yaml", - "version": "v6.2.5", + "version": "v6.3.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "2bbfbdacc8a15574f8440c4838ce0d7bb6c86b19" + "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/2bbfbdacc8a15574f8440c4838ce0d7bb6c86b19", - "reference": "2bbfbdacc8a15574f8440c4838ce0d7bb6c86b19", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e23292e8c07c85b971b44c1c4b87af52133e2add", + "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add", "shasum": "" }, "require": { "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -2758,9 +2792,6 @@ "require-dev": { "symfony/console": "^5.4|^6.0" }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, "bin": [ "Resources/bin/yaml-lint" ], @@ -2790,7 +2821,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.2.5" + "source": "https://github.com/symfony/yaml/tree/v6.3.3" }, "funding": [ { @@ -2806,44 +2837,90 @@ "type": "tidelift" } ], - "time": "2023-01-10T18:53:53+00:00" + "time": "2023-07-31T07:08:24+00:00" + }, + { + "name": "tnapf/router", + "version": "v6.0.1", + "source": { + "type": "git", + "url": "https://github.com/tnapf/Router.git", + "reference": "12c2850bb8c2cc28a861b889072c82bc41146265" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tnapf/Router/zipball/12c2850bb8c2cc28a861b889072c82bc41146265", + "reference": "12c2850bb8c2cc28a861b889072c82bc41146265", + "shasum": "" + }, + "require": { + "commandstring/utils": "^1.4", + "httpsoft/http-emitter": "^1.0", + "httpsoft/http-message": "^1.0.12", + "httpsoft/http-response": "^1.0", + "httpsoft/http-server-request": "^1.0", + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.1", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Tnapf\\Router\\": "src/", + "Tests\\Tnapf\\Router\\": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Robert Snedeker", + "email": "rsnedeker20@gmail.com" + } + ], + "description": "Totally Not Another PHP Framework's router package", + "support": { + "issues": "https://github.com/tnapf/Router/issues", + "source": "https://github.com/tnapf/Router/tree/v6.0.1" + }, + "time": "2023-06-14T22:49:01+00:00" } ], "packages-dev": [ { "name": "symfony/var-dumper", - "version": "v6.2.5", + "version": "v6.3.5", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "44b7b81749fd20c1bdf4946c041050e22bc8da27" + "reference": "3d9999376be5fea8de47752837a3e1d1c5f69ef5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/44b7b81749fd20c1bdf4946c041050e22bc8da27", - "reference": "44b7b81749fd20c1bdf4946c041050e22bc8da27", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3d9999376be5fea8de47752837a3e1d1c5f69ef5", + "reference": "3d9999376be5fea8de47752837a3e1d1c5f69ef5", "shasum": "" }, "require": { "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "phpunit/phpunit": "<5.4.3", "symfony/console": "<5.4" }, "require-dev": { "ext-iconv": "*", "symfony/console": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0", "symfony/process": "^5.4|^6.0", "symfony/uid": "^5.4|^6.0", "twig/twig": "^2.13|^3.0.4" }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, "bin": [ "Resources/bin/var-dump-server" ], @@ -2880,7 +2957,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.2.5" + "source": "https://github.com/symfony/var-dumper/tree/v6.3.5" }, "funding": [ { @@ -2896,13 +2973,12 @@ "type": "tidelift" } ], - "time": "2023-01-20T17:45:48+00:00" + "time": "2023-09-12T10:11:35+00:00" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": { - "alexmorbo/reactphp-router": 20, "alexmorbo/trassir-php": 20 }, "prefer-stable": false, @@ -2911,5 +2987,5 @@ "php": ">=8.2" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/src/Controller/AbstractController.php b/src/Controller/AbstractController.php index 6129e85..66ee267 100644 --- a/src/Controller/AbstractController.php +++ b/src/Controller/AbstractController.php @@ -2,28 +2,10 @@ namespace AlexMorbo\React\Trassir\Controller; -use React\Router\Http\Router; +use Tnapf\Router\Router; abstract class AbstractController { - protected $middlewares = [ - 'before' => [], - 'after' => [], - ]; - - public const BEFORE_MIDDLEWARE = 'before'; - public const AFTER_MIDDLEWARE = 'after'; - - public function hasMiddlewares(): bool - { - return !empty($this->middlewares['before']) || !empty($this->middlewares['after']); - } - - public function getMiddlewares(string $type): array - { - return $this->middlewares[$type] ?? []; - } - public function addRoutes(Router $router): void { } diff --git a/src/Controller/InfoController.php b/src/Controller/InfoController.php index b62bd53..1b43b14 100644 --- a/src/Controller/InfoController.php +++ b/src/Controller/InfoController.php @@ -5,9 +5,10 @@ use Fig\Http\Message\StatusCodeInterface; use HttpSoft\Response\JsonResponse; use Psr\Http\Message\ResponseInterface; +use Psr\Log\LoggerInterface; use React\Http\Message\Response; -use React\Router\Http\Router; use Symfony\Component\Yaml\Yaml; +use Tnapf\Router\Router; class InfoController extends AbstractController { @@ -20,10 +21,9 @@ public function __construct(private Yaml $yaml) public function addRoutes(Router $router): void { - $router - ->get("/api/version", [$this, 'version']) - ->get("/api/openapi.yml", [$this, 'yml']) - ->get("/api/openapi.json", [$this, 'json']); + $router->get("/api/version", fn() => $this->version()); + $router->get("/api/openapi.yml", fn() => $this->yml()); + $router->get("/api/openapi.json", fn() => $this->json()); } public function version(): ResponseInterface diff --git a/src/Controller/InstanceController.php b/src/Controller/InstanceController.php index 80f0c6e..51d6ee7 100644 --- a/src/Controller/InstanceController.php +++ b/src/Controller/InstanceController.php @@ -3,6 +3,7 @@ namespace AlexMorbo\React\Trassir\Controller; use AlexMorbo\React\Trassir\Dto\Instance; +use AlexMorbo\React\Trassir\Log; use AlexMorbo\React\Trassir\Traits\DBTrait; use AlexMorbo\React\Trassir\TrassirHelper; use AlexMorbo\Trassir\TrassirException; @@ -10,11 +11,15 @@ use Exception; use Fig\Http\Message\StatusCodeInterface; use HttpSoft\Response\JsonResponse; +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\ServerRequestInterface; +use Psr\Log\LoggerInterface; use React\Http\Message\Response; -use React\Http\Message\ServerRequest; -use React\Promise\PromiseInterface; -use React\Router\Http\Router; +use Tnapf\Router\Handlers\ClosureRequestHandler; +use Tnapf\Router\Router; +use Tnapf\Router\Routing\RouteRunner; +use function React\Async\await; use function React\Promise\all; use function React\Promise\resolve; @@ -22,25 +27,89 @@ class InstanceController extends AbstractController { use DBTrait; - public function __construct(DatabaseInterface $db, private TrassirHelper $trassirHelper) - { + public function __construct( + private LoggerInterface $logger, + DatabaseInterface $db, + protected TrassirHelper $trassirHelper + ) { $this->initDB($db); } public function addRoutes(Router $router): void { + $router->get("/api/instances", ClosureRequestHandler::new(fn() => $this->getInstances())); + $router->post( + "/api/instances", + ClosureRequestHandler::new( + fn(ServerRequestInterface $request, ResponseInterface $response) => $this->addInstance( + $request, + $response + ) + ) + ); + $router + ->delete( + "/api/instance/{instanceId}", + ClosureRequestHandler::new( + fn( + ServerRequestInterface $request, + ResponseInterface $response, + RouteRunner $runner + ) => $this->deleteInstance($runner->getParameter('instanceId')) + ) + ) + ->setParameter('instanceId', '\d+'); $router - ->get("/api/instances", [$this, 'getInstances']) - ->post("/api/instances", [$this, 'addInstance']) - ->delete("/api/instance/(\d+)", [$this, 'deleteInstance']) - ->get("/api/instance/(\d+)", [$this, 'getInstance']) - ->get("/api/instance/(\d+)/channel/(.*)/screenshot", [$this, 'getChannelScreenshot']) - ->get("/api/instance/(\d+)/channel/(.*)/video/(.*)", [$this, 'getChannelVideo']); + ->get( + "/api/instance/{instanceId}", + ClosureRequestHandler::new( + fn( + ServerRequestInterface $request, + ResponseInterface $response, + RouteRunner $runner + ) => $this->getInstance($runner->getParameter('instanceId')) + ) + ) + ->setParameter('instanceId', '\d+'); + $router + ->get( + "/api/instance/{instanceId}/channel/{channelId}/screenshot", + ClosureRequestHandler::new( + fn( + ServerRequestInterface $request, + ResponseInterface $response, + RouteRunner $runner + ) => $this->getChannelScreenshot( + $response, + $runner->getParameter('instanceId'), + $runner->getParameter('channelId'), + ) + ) + ) + ->setParameter('instanceId', '\d+'); + $router + ->get( + "/api/instance/{instanceId}/channel/{channelId}/video/{streamType}", + ClosureRequestHandler::new( + fn( + ServerRequestInterface $request, + ResponseInterface $response, + RouteRunner $runner + ) => $this->getChannelVideo( + $request, + $response, + $runner->getParameter('instanceId'), + $runner->getParameter('channelId'), + $runner->getParameter('streamType'), + ) + ) + ) + ->setParameter('instanceId', '\d+'); } - public function getInstances(): PromiseInterface + public function getInstances(): ResponseInterface { - return $this + $promise = $this ->dbSearch('instances') ->then( function ($result) { @@ -62,12 +131,16 @@ function (Instance $instance) use ($instanceData) { ->then(fn($instancesData) => new JsonResponse($instancesData)); } ); + + return await($promise); } - public function getInstance(ServerRequest $request, Response $response, string $instanceId): PromiseInterface - { + public function getInstance( + string $instanceId + ): ResponseInterface { $instanceId = (int)$instanceId; - return $this->dbSearch('instances', ['id' => $instanceId]) + + $promise = $this->dbSearch('instances', ['id' => $instanceId]) ->then( function ($result) use ($instanceId) { if (!$result) { @@ -87,9 +160,11 @@ function (Instance $instance) use ($result) { ->then(fn($instanceData) => new JsonResponse($instanceData)); } ); + + return await($promise); } - public function addInstance(ServerRequest $request, Response $response): PromiseInterface + public function addInstance(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface { if ( $request->hasHeader('Content-Type') && @@ -97,7 +172,7 @@ public function addInstance(ServerRequest $request, Response $response): Promise ) { $input = json_decode($request->getBody()->getContents(), true); if (json_last_error() !== JSON_ERROR_NONE) { - return resolve(new JsonResponse(['status' => 'error', 'error' => 'Invalid JSON'], 400)); + return new JsonResponse(['status' => 'error', 'error' => 'Invalid JSON'], 400); } } @@ -108,7 +183,7 @@ public function addInstance(ServerRequest $request, Response $response): Promise empty($input['login']) || empty($input['password']) ) { - return resolve(new JsonResponse(['status' => 'error', 'error' => 'Invalid data'], 400)); + return new JsonResponse(['status' => 'error', 'error' => 'Invalid data'], 400); } $instanceId = $this->dbInsert('instances', [ @@ -120,7 +195,7 @@ public function addInstance(ServerRequest $request, Response $response): Promise 'created_at' => date('Y-m-d H:i:s'), ]); - return $instanceId + $promise = $instanceId ->then( function ($instanceId) { return $this->trassirHelper @@ -129,7 +204,7 @@ function ($instanceId) { function (Instance $instance) use ($instanceId) { return $instance->getTrassir()->getConnection() ->then( - function() use ($instance, $instanceId) { + function () use ($instance, $instanceId) { $settings = $instance->getTrassir()->getSettings(); $this->dbUpdate( 'instances', @@ -137,10 +212,18 @@ function() use ($instance, $instanceId) { ['id' => $instanceId] ); - return new JsonResponse(['status' => 'success', 'id' => $instanceId]); + $this->logger->info('Instance created', ['instanceId' => $instanceId]); + + return $this->trassirHelper + ->pull() + ->then( + fn() => new JsonResponse( + ['status' => 'success', 'id' => $instanceId] + ) + ); } ) - ->otherwise( + ->catch( fn(Exception $e) => new JsonResponse([ 'status' => 'error', 'error' => $e->getMessage() @@ -153,38 +236,52 @@ function ($error) { return new JsonResponse(['status' => 'error', 'error' => $error]); } ); + + return await($promise); } - public function deleteInstance(ServerRequest $request, Response $response, $input): PromiseInterface - { - return $this + public function deleteInstance( + $instanceId + ): ResponseInterface { + $instanceId = (int)$instanceId; + + $promise = $this ->dbDelete('instances', [ - 'id' => $input, + 'id' => $instanceId, ]) ->then( - function (int $deletedRows) { + function (int $deletedRows) use ($instanceId) { if ($deletedRows === 0) { + $this->logger->warning('Instance not deleted', ['instanceId' => $instanceId]); + return new JsonResponse( - ['status' => 'error', 'error' => 'Instance not found'], StatusCodeInterface::STATUS_NOT_FOUND + ['status' => 'error', 'error' => 'Instance not found'], + StatusCodeInterface::STATUS_NOT_FOUND ); } - return new Response(StatusCodeInterface::STATUS_NO_CONTENT); + $this->logger->info('Instance deleted', ['instanceId' => $instanceId]); + + return $this->trassirHelper + ->pull() + ->then(fn() => new Response(StatusCodeInterface::STATUS_NO_CONTENT)); }, function ($error) { return new JsonResponse(['status' => 'error', 'error' => $error]); } ); + + return await($promise); } public function getChannelScreenshot( - ServerRequest $request, - Response $response, + ResponseInterface $response, string $instanceId, string $channelId - ): PromiseInterface { + ): ResponseInterface { $instanceId = (int)$instanceId; - return $this->trassirHelper->getInstance($instanceId) + + $promise = $this->trassirHelper->getInstance($instanceId) ->then( function (Instance $instance) use ($channelId) { foreach ($instance->getTrassir()->getChannels() as $type => $channels) { @@ -206,22 +303,24 @@ function ($screenshot) use ($response) { return $response; } ); + + return await($promise); } public function getChannelVideo( - ServerRequest $request, - Response $response, + ServerRequestInterface $request, + ResponseInterface $response, string $instanceId, string $channelId, string $streamType, - ): PromiseInterface { + ): ResponseInterface { $instanceId = (int)$instanceId; if (!in_array($streamType, ['hls', 'rtsp'])) { return resolve(new JsonResponse(['status' => 'error', 'error' => 'Invalid stream type'], 400)); } - return $this->trassirHelper->getInstance($instanceId) + $promise = $this->trassirHelper->getInstance($instanceId) ->then( function (Instance $instance) use ($channelId, $streamType) { foreach ($instance->getTrassir()->getChannels() as $type => $channels) { @@ -264,6 +363,8 @@ function (Exception $e) { return new JsonResponse(['status' => 'error', 'error' => $e->getMessage()], 404); } ); + + return await($promise); } diff --git a/src/Server.php b/src/Server.php index b12fa09..1697796 100644 --- a/src/Server.php +++ b/src/Server.php @@ -2,22 +2,23 @@ namespace AlexMorbo\React\Trassir; -use AlexMorbo\React\Trassir\Controller\AbstractController; use AlexMorbo\React\Trassir\Controller\InfoController; use AlexMorbo\React\Trassir\Controller\InstanceController; use Clue\React\SQLite\DatabaseInterface; use Clue\React\SQLite\Factory; -use DateTime; +use Exception; use HttpSoft\Response\JsonResponse; -use HttpSoft\Response\TextResponse; +use Monolog\Formatter\JsonFormatter; use Monolog\Handler\StreamHandler; use Monolog\Level; use Monolog\Logger; +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\ServerRequestInterface; use React\EventLoop\Loop; use React\EventLoop\LoopInterface; +use React\Http\HttpServer; use React\Promise\PromiseInterface; use React\Socket\SocketServer; -use React\Router\Http\Router; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -25,8 +26,9 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Yaml\Yaml; use Throwable; - -use function React\Promise\resolve; +use Tnapf\Router\Exceptions\HttpNotFound; +use Tnapf\Router\Router; +use Tnapf\Router\Routing\RouteRunner; class Server extends Command { @@ -42,9 +44,9 @@ public function __construct() { $this->dbPath = __DIR__ . '/../data/data.db'; $this->logger = new Logger('react-trassir'); - $this->logger->pushHandler( - new StreamHandler('php://stdout', getenv('LOG_LEVEL') ?: Level::Debug) - ); + $handler = new StreamHandler('php://stdout', getenv('LOG_LEVEL') ?: Level::Debug); + $handler->setFormatter(new JsonFormatter()); + $this->logger->pushHandler($handler); parent::__construct(); } @@ -95,6 +97,7 @@ private function getControllers(): array return [ new InfoController(new Yaml()), new InstanceController( + $this->logger, $this->db, $this->trassirHelper ), @@ -119,65 +122,67 @@ private function migrate(): PromiseInterface private function initServer(string $ip, int $port): int { - try { - $socket = new SocketServer(sprintf("%s:%s", $ip, $port), [], $this->loop); - } catch (Throwable $e) { - echo $e->getMessage() . PHP_EOL; - - $this->loop->stop(); - return Command::FAILURE; - } - - $router = new Router($socket); - $this->addRoutes($router); - $this->addMiddlewares($router); + $socket = new SocketServer(sprintf("%s:%s", $ip, $port), [], $this->loop); + $router = $this->getRouter(); - $router - ->map404("/(.*)", function () { - return resolve(new JsonResponse(['status' => 'error', 'error' => 'Route not found'], 404)); - }) - ->map500("/(.*)", function () { - return resolve(new TextResponse("An internal error has occurred", 500)); - }); - - $router - ->getHttpServer() - ->on('error', fn() => var_dump(func_get_args())); + $http = new HttpServer( + static function (ServerRequestInterface $request) use ($router) { + return $router->run($request); + } + ); + $http->on('error', function (Exception $e) { + $this->logger->error($e->getMessage(), [ + 'trace' => $e->getTraceAsString() + ]); - $router->listen(); + $this->loop->stop(); + }); + $http->listen($socket); - echo 'Listening on ' . str_replace('tcp:', 'http:', $socket->getAddress()) . PHP_EOL; + $this->logger->info( + 'Listening on ' . str_replace('tcp:', 'http:', $socket->getAddress()) + ); $this->loop->addPeriodicTimer(300, function () { - echo sprintf( - '[%s] Current usage %f mb, Max: %f mb' . PHP_EOL, - (new DateTime())->format('Y-m-d H:i:s'), - round(memory_get_usage() / 1024 / 1024, 2) . ' mb', - round(memory_get_peak_usage() / 1024 / 1024, 2) . ' mb' + $this->logger->info( + sprintf( + 'Current memory usage %f mb, max: %f mb', + round(memory_get_usage() / 1024 / 1024, 2) . ' mb', + round(memory_get_peak_usage() / 1024 / 1024, 2) . ' mb' + ), + [ + 'memory_current' => memory_get_usage(), + 'memory_max' => memory_get_peak_usage(), + ] ); }); return Command::SUCCESS; } - protected function addRoutes(Router $router): void + private function getRouter(): Router { - foreach ($this->getControllers() as $controller) { - $controller->addRoutes($router); - } + $router = new Router(); + $this->addRoutes($router); + + $router->catch( + HttpNotFound::class, + fn() => new JsonResponse(['status' => 'error', 'error' => 'Route not found']) + ); + $router->catch( + Throwable::class, + fn(ServerRequestInterface $request, ResponseInterface $response, RouteRunner $route) => new JsonResponse( + ['status' => 'error', 'error' => 'Internal Error', 'message' => $route->exception->getMessage()] + ) + ); + + return $router; } - protected function addMiddlewares(Router $router): void + protected function addRoutes(Router $router): void { foreach ($this->getControllers() as $controller) { - if ($controller->hasMiddlewares()) { - foreach ($controller->getMiddlewares(AbstractController::BEFORE_MIDDLEWARE) as $middleware) { - $router->beforeMiddleware($middleware[0], $middleware[1]); - } - foreach ($controller->getMiddlewares(AbstractController::AFTER_MIDDLEWARE) as $middleware) { - $router->afterMiddleware($middleware[0], $middleware[1]); - } - } + $controller->addRoutes($router); } } } diff --git a/src/Traits/DBTrait.php b/src/Traits/DBTrait.php index 226057e..96c03ba 100644 --- a/src/Traits/DBTrait.php +++ b/src/Traits/DBTrait.php @@ -3,7 +3,6 @@ namespace AlexMorbo\React\Trassir\Traits; use Clue\React\SQLite\DatabaseInterface; -use Clue\React\SQLite\Io\LazyDatabase; use Clue\React\SQLite\Result; use React\Promise\PromiseInterface; @@ -13,9 +12,9 @@ trait DBTrait { - protected DatabaseInterface|LazyDatabase $db; + protected DatabaseInterface $db; - protected function initDB(DatabaseInterface|LazyDatabase $db) + protected function initDB(DatabaseInterface $db) { $this->db = $db; } diff --git a/src/TrassirHelper.php b/src/TrassirHelper.php index 59c4374..b995da3 100644 --- a/src/TrassirHelper.php +++ b/src/TrassirHelper.php @@ -81,6 +81,7 @@ public function pull(): PromiseInterface ->then( function ($result) { $promises = []; + $this->instances = []; foreach ($result as $instanceData) { $this->instances[$instanceData['id']] = new Instance( $instanceData, $this->getTrassirInstance($instanceData)