diff --git a/composer.json b/composer.json index d2f67b2..ad341be 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,6 @@ { "name": "scrawler/app", + "version": "2.0", "description": "scrawler framework main app container", "type": "library", "license": "MIT", diff --git a/composer.lock b/composer.lock index cee9f0c..111a3dc 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": "00b473859f782ceabdac3bd9c5185d97", + "content-hash": "282f9026909b1cdc8b91d6441e23e853", "packages": [ { "name": "graham-campbell/result-type", @@ -70,16 +70,16 @@ }, { "name": "laravel/serializable-closure", - "version": "v1.3.5", + "version": "v1.3.7", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c" + "reference": "4f48ade902b94323ca3be7646db16209ec76be3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c", - "reference": "1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/4f48ade902b94323ca3be7646db16209ec76be3d", + "reference": "4f48ade902b94323ca3be7646db16209ec76be3d", "shasum": "" }, "require": { @@ -127,7 +127,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2024-09-23T13:33:08+00:00" + "time": "2024-11-14T18:34:49+00:00" }, { "name": "phlak/config", @@ -496,16 +496,16 @@ }, { "name": "scrawler/http", - "version": "v2.0.2", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/scrawler-labs/http.git", - "reference": "45a3446dcd0cfe2ed70a04b9198fa68eccbfcab0" + "reference": "f74ccefea543f9f111d7540fa119ca17b90fc334" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/scrawler-labs/http/zipball/45a3446dcd0cfe2ed70a04b9198fa68eccbfcab0", - "reference": "45a3446dcd0cfe2ed70a04b9198fa68eccbfcab0", + "url": "https://api.github.com/repos/scrawler-labs/http/zipball/f74ccefea543f9f111d7540fa119ca17b90fc334", + "reference": "f74ccefea543f9f111d7540fa119ca17b90fc334", "shasum": "" }, "require": { @@ -543,9 +543,9 @@ "description": "Http component for scrawler framework", "support": { "issues": "https://github.com/scrawler-labs/http/issues", - "source": "https://github.com/scrawler-labs/http/tree/v2.0.2" + "source": "https://github.com/scrawler-labs/http/tree/v2.1.1" }, - "time": "2024-10-13T07:52:14+00:00" + "time": "2024-11-24T19:15:41+00:00" }, { "name": "scrawler/router", @@ -675,16 +675,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.4.12", + "version": "v6.4.15", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "133ac043875f59c26c55e79cf074562127cce4d2" + "reference": "9b3165eb2f04aeaa1a5a2cfef73e63fe3b22dff6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/133ac043875f59c26c55e79cf074562127cce4d2", - "reference": "133ac043875f59c26c55e79cf074562127cce4d2", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/9b3165eb2f04aeaa1a5a2cfef73e63fe3b22dff6", + "reference": "9b3165eb2f04aeaa1a5a2cfef73e63fe3b22dff6", "shasum": "" }, "require": { @@ -694,12 +694,12 @@ "symfony/polyfill-php83": "^1.27" }, "conflict": { - "symfony/cache": "<6.3" + "symfony/cache": "<6.4.12|>=7.0,<7.1.5" }, "require-dev": { "doctrine/dbal": "^2.13.1|^3|^4", "predis/predis": "^1.1|^2.0", - "symfony/cache": "^6.3|^7.0", + "symfony/cache": "^6.4.12|^7.1.5", "symfony/dependency-injection": "^5.4|^6.0|^7.0", "symfony/expression-language": "^5.4|^6.0|^7.0", "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4|^7.0", @@ -732,7 +732,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.12" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.15" }, "funding": [ { @@ -748,7 +748,7 @@ "type": "tidelift" } ], - "time": "2024-09-20T08:18:25+00:00" + "time": "2024-11-08T16:09:24+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1067,16 +1067,16 @@ }, { "name": "symfony/yaml", - "version": "v6.4.12", + "version": "v6.4.13", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "762ee56b2649659380e0ef4d592d807bc17b7971" + "reference": "e99b4e94d124b29ee4cf3140e1b537d2dad8cec9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/762ee56b2649659380e0ef4d592d807bc17b7971", - "reference": "762ee56b2649659380e0ef4d592d807bc17b7971", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e99b4e94d124b29ee4cf3140e1b537d2dad8cec9", + "reference": "e99b4e94d124b29ee4cf3140e1b537d2dad8cec9", "shasum": "" }, "require": { @@ -1119,7 +1119,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.12" + "source": "https://github.com/symfony/yaml/tree/v6.4.13" }, "funding": [ { @@ -1135,7 +1135,7 @@ "type": "tidelift" } ], - "time": "2024-09-17T12:47:12+00:00" + "time": "2024-09-25T14:18:03+00:00" }, { "name": "thecodingmachine/safe", @@ -1746,28 +1746,28 @@ }, { "name": "jean85/pretty-package-versions", - "version": "2.0.6", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "f9fdd29ad8e6d024f52678b570e5593759b550b4" + "reference": "3c4e5f62ba8d7de1734312e4fff32f67a8daaf10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/f9fdd29ad8e6d024f52678b570e5593759b550b4", - "reference": "f9fdd29ad8e6d024f52678b570e5593759b550b4", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/3c4e5f62ba8d7de1734312e4fff32f67a8daaf10", + "reference": "3c4e5f62ba8d7de1734312e4fff32f67a8daaf10", "shasum": "" }, "require": { - "composer-runtime-api": "^2.0.0", - "php": "^7.1|^8.0" + "composer-runtime-api": "^2.1.0", + "php": "^7.4|^8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.2", "jean85/composer-provided-replaced-stub-package": "^1.0", "phpstan/phpstan": "^1.4", - "phpunit/phpunit": "^7.5|^8.5|^9.4", - "vimeo/psalm": "^4.3" + "phpunit/phpunit": "^7.5|^8.5|^9.6", + "vimeo/psalm": "^4.3 || ^5.0" }, "type": "library", "extra": { @@ -1799,22 +1799,22 @@ ], "support": { "issues": "https://github.com/Jean85/pretty-package-versions/issues", - "source": "https://github.com/Jean85/pretty-package-versions/tree/2.0.6" + "source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.0" }, - "time": "2024-03-08T09:58:59+00:00" + "time": "2024-11-18T16:19:46+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.12.0", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", "shasum": "" }, "require": { @@ -1853,7 +1853,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" }, "funding": [ { @@ -1861,7 +1861,7 @@ "type": "tidelift" } ], - "time": "2024-06-12T14:39:25+00:00" + "time": "2024-11-08T17:47:46+00:00" }, { "name": "nikic/php-parser", @@ -2020,31 +2020,31 @@ }, { "name": "nunomaduro/termwind", - "version": "v2.2.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/nunomaduro/termwind.git", - "reference": "42c84e4e8090766bbd6445d06cd6e57650626ea3" + "reference": "52915afe6a1044e8b9cee1bcff836fb63acf9cda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/42c84e4e8090766bbd6445d06cd6e57650626ea3", - "reference": "42c84e4e8090766bbd6445d06cd6e57650626ea3", + "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/52915afe6a1044e8b9cee1bcff836fb63acf9cda", + "reference": "52915afe6a1044e8b9cee1bcff836fb63acf9cda", "shasum": "" }, "require": { "ext-mbstring": "*", "php": "^8.2", - "symfony/console": "^7.1.5" + "symfony/console": "^7.1.8" }, "require-dev": { - "illuminate/console": "^11.28.0", - "laravel/pint": "^1.18.1", + "illuminate/console": "^11.33.2", + "laravel/pint": "^1.18.2", "mockery/mockery": "^1.6.12", "pestphp/pest": "^2.36.0", - "phpstan/phpstan": "^1.12.6", + "phpstan/phpstan": "^1.12.11", "phpstan/phpstan-strict-rules": "^1.6.1", - "symfony/var-dumper": "^7.1.5", + "symfony/var-dumper": "^7.1.8", "thecodingmachine/phpstan-strict-rules": "^1.0.0" }, "type": "library", @@ -2087,7 +2087,7 @@ ], "support": { "issues": "https://github.com/nunomaduro/termwind/issues", - "source": "https://github.com/nunomaduro/termwind/tree/v2.2.0" + "source": "https://github.com/nunomaduro/termwind/tree/v2.3.0" }, "funding": [ { @@ -2103,20 +2103,20 @@ "type": "github" } ], - "time": "2024-10-15T16:15:16+00:00" + "time": "2024-11-21T10:39:51+00:00" }, { "name": "pestphp/pest", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/pestphp/pest.git", - "reference": "eaeb133c77f3f5382620f0307c3b45b34961bcfc" + "reference": "179d46ce97d52bcb3f791449ae94025c3f32e3e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest/zipball/eaeb133c77f3f5382620f0307c3b45b34961bcfc", - "reference": "eaeb133c77f3f5382620f0307c3b45b34961bcfc", + "url": "https://api.github.com/repos/pestphp/pest/zipball/179d46ce97d52bcb3f791449ae94025c3f32e3e3", + "reference": "179d46ce97d52bcb3f791449ae94025c3f32e3e3", "shasum": "" }, "require": { @@ -2127,18 +2127,18 @@ "pestphp/pest-plugin-arch": "^3.0.0", "pestphp/pest-plugin-mutate": "^3.0.5", "php": "^8.2.0", - "phpunit/phpunit": "^11.4.2" + "phpunit/phpunit": "^11.4.3" }, "conflict": { "filp/whoops": "<2.16.0", - "phpunit/phpunit": ">11.4.2", + "phpunit/phpunit": ">11.4.3", "sebastian/exporter": "<6.0.0", "webmozart/assert": "<1.11.0" }, "require-dev": { "pestphp/pest-dev-tools": "^3.3.0", "pestphp/pest-plugin-type-coverage": "^3.1.0", - "symfony/process": "^7.1.5" + "symfony/process": "^7.1.6" }, "bin": [ "bin/pest" @@ -2203,7 +2203,7 @@ ], "support": { "issues": "https://github.com/pestphp/pest/issues", - "source": "https://github.com/pestphp/pest/tree/v3.5.0" + "source": "https://github.com/pestphp/pest/tree/v3.5.1" }, "funding": [ { @@ -2215,7 +2215,7 @@ "type": "github" } ], - "time": "2024-10-22T14:33:27+00:00" + "time": "2024-10-31T16:12:45+00:00" }, { "name": "pestphp/pest-plugin", @@ -2602,16 +2602,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.1", + "version": "5.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" + "reference": "f3558a4c23426d12bffeaab463f8a8d8b681193c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", - "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/f3558a4c23426d12bffeaab463f8a8d8b681193c", + "reference": "f3558a4c23426d12bffeaab463f8a8d8b681193c", "shasum": "" }, "require": { @@ -2620,17 +2620,17 @@ "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.2", "phpdocumentor/type-resolver": "^1.7", - "phpstan/phpdoc-parser": "^1.7", + "phpstan/phpdoc-parser": "^1.7|^2.0", "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.5", + "mockery/mockery": "~1.3.5 || ~1.6.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-mockery": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^5.13" + "psalm/phar": "^5.26" }, "type": "library", "extra": { @@ -2660,29 +2660,29 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.0" }, - "time": "2024-05-21T05:55:05+00:00" + "time": "2024-11-12T11:25:25+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.8.2", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "153ae662783729388a584b4361f2545e4d841e3c" + "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c", - "reference": "153ae662783729388a584b4361f2545e4d841e3c", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/679e3ce485b99e84c775d28e2e96fade9a7fb50a", + "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a", "shasum": "" }, "require": { "doctrine/deprecations": "^1.0", "php": "^7.3 || ^8.0", "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.13" + "phpstan/phpdoc-parser": "^1.18|^2.0" }, "require-dev": { "ext-tokenizer": "*", @@ -2718,36 +2718,36 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.10.0" }, - "time": "2024-02-23T11:10:43+00:00" + "time": "2024-11-09T15:12:26+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.33.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140" + "reference": "c00d78fb6b29658347f9d37ebe104bffadf36299" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/c00d78fb6b29658347f9d37ebe104bffadf36299", + "reference": "c00d78fb6b29658347f9d37ebe104bffadf36299", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "doctrine/annotations": "^2.0", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^5.3.0", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.5", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", "symfony/process": "^5.2" }, "type": "library", @@ -2765,22 +2765,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.0.0" }, - "time": "2024-10-13T11:25:22+00:00" + "time": "2024-10-13T11:29:49+00:00" }, { "name": "phpstan/phpstan", - "version": "1.12.7", + "version": "1.12.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" + "reference": "0d1fc20a962a91be578bcfe7cf939e6e1a2ff733" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0d1fc20a962a91be578bcfe7cf939e6e1a2ff733", + "reference": "0d1fc20a962a91be578bcfe7cf939e6e1a2ff733", "shasum": "" }, "require": { @@ -2825,7 +2825,7 @@ "type": "github" } ], - "time": "2024-10-18T11:12:07+00:00" + "time": "2024-11-17T14:08:01+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3152,16 +3152,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.4.2", + "version": "11.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1863643c3f04ad03dcb9c6996c294784cdda4805" + "reference": "e8e8ed1854de5d36c088ec1833beae40d2dedd76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1863643c3f04ad03dcb9c6996c294784cdda4805", - "reference": "1863643c3f04ad03dcb9c6996c294784cdda4805", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e8e8ed1854de5d36c088ec1833beae40d2dedd76", + "reference": "e8e8ed1854de5d36c088ec1833beae40d2dedd76", "shasum": "" }, "require": { @@ -3232,7 +3232,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.4.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.4.3" }, "funding": [ { @@ -3248,7 +3248,7 @@ "type": "tidelift" } ], - "time": "2024-10-19T13:05:19+00:00" + "time": "2024-10-28T13:07:50+00:00" }, { "name": "psr/log", @@ -3302,16 +3302,16 @@ }, { "name": "rector/rector", - "version": "1.2.8", + "version": "1.2.10", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "05755bf43617449c08ee8e50fb840c85ad3b1240" + "reference": "40f9cf38c05296bd32f444121336a521a293fa61" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/05755bf43617449c08ee8e50fb840c85ad3b1240", - "reference": "05755bf43617449c08ee8e50fb840c85ad3b1240", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/40f9cf38c05296bd32f444121336a521a293fa61", + "reference": "40f9cf38c05296bd32f444121336a521a293fa61", "shasum": "" }, "require": { @@ -3349,7 +3349,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.8" + "source": "https://github.com/rectorphp/rector/tree/1.2.10" }, "funding": [ { @@ -3357,7 +3357,7 @@ "type": "github" } ], - "time": "2024-10-18T11:54:27+00:00" + "time": "2024-11-08T13:59:10+00:00" }, { "name": "sebastian/cli-parser", @@ -3531,16 +3531,16 @@ }, { "name": "sebastian/comparator", - "version": "6.1.1", + "version": "6.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5ef523a49ae7a302b87b2102b72b1eda8918d686" + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5ef523a49ae7a302b87b2102b72b1eda8918d686", - "reference": "5ef523a49ae7a302b87b2102b72b1eda8918d686", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/43d129d6a0f81c78bee378b46688293eb7ea3739", + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739", "shasum": "" }, "require": { @@ -3551,12 +3551,12 @@ "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^11.3" + "phpunit/phpunit": "^11.4" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.1-dev" + "dev-main": "6.2-dev" } }, "autoload": { @@ -3596,7 +3596,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.1.1" + "source": "https://github.com/sebastianbergmann/comparator/tree/6.2.1" }, "funding": [ { @@ -3604,7 +3604,7 @@ "type": "github" } ], - "time": "2024-10-18T15:00:48+00:00" + "time": "2024-10-31T05:30:08+00:00" }, { "name": "sebastian/complexity", @@ -4284,16 +4284,16 @@ }, { "name": "symfony/console", - "version": "v7.1.5", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee" + "reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0fa539d12b3ccf068a722bbbffa07ca7079af9ee", - "reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee", + "url": "https://api.github.com/repos/symfony/console/zipball/ff04e5b5ba043d2badfb308197b9e6b42883fcd5", + "reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5", "shasum": "" }, "require": { @@ -4357,7 +4357,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.5" + "source": "https://github.com/symfony/console/tree/v7.1.8" }, "funding": [ { @@ -4373,20 +4373,20 @@ "type": "tidelift" } ], - "time": "2024-09-20T08:28:38+00:00" + "time": "2024-11-06T14:23:19+00:00" }, { "name": "symfony/finder", - "version": "v7.1.4", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "d95bbf319f7d052082fb7af147e0f835a695e823" + "reference": "2cb89664897be33f78c65d3d2845954c8d7a43b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/d95bbf319f7d052082fb7af147e0f835a695e823", - "reference": "d95bbf319f7d052082fb7af147e0f835a695e823", + "url": "https://api.github.com/repos/symfony/finder/zipball/2cb89664897be33f78c65d3d2845954c8d7a43b8", + "reference": "2cb89664897be33f78c65d3d2845954c8d7a43b8", "shasum": "" }, "require": { @@ -4421,7 +4421,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.1.4" + "source": "https://github.com/symfony/finder/tree/v7.1.6" }, "funding": [ { @@ -4437,7 +4437,7 @@ "type": "tidelift" } ], - "time": "2024-08-13T14:28:19+00:00" + "time": "2024-10-01T08:31:23+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -4600,16 +4600,16 @@ }, { "name": "symfony/process", - "version": "v7.1.5", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "5c03ee6369281177f07f7c68252a280beccba847" + "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5c03ee6369281177f07f7c68252a280beccba847", - "reference": "5c03ee6369281177f07f7c68252a280beccba847", + "url": "https://api.github.com/repos/symfony/process/zipball/42783370fda6e538771f7c7a36e9fa2ee3a84892", + "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892", "shasum": "" }, "require": { @@ -4641,7 +4641,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.5" + "source": "https://github.com/symfony/process/tree/v7.1.8" }, "funding": [ { @@ -4657,7 +4657,7 @@ "type": "tidelift" } ], - "time": "2024-09-19T21:48:23+00:00" + "time": "2024-11-06T14:23:19+00:00" }, { "name": "symfony/service-contracts", @@ -4744,16 +4744,16 @@ }, { "name": "symfony/string", - "version": "v7.1.5", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "d66f9c343fa894ec2037cc928381df90a7ad4306" + "reference": "591ebd41565f356fcd8b090fe64dbb5878f50281" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/d66f9c343fa894ec2037cc928381df90a7ad4306", - "reference": "d66f9c343fa894ec2037cc928381df90a7ad4306", + "url": "https://api.github.com/repos/symfony/string/zipball/591ebd41565f356fcd8b090fe64dbb5878f50281", + "reference": "591ebd41565f356fcd8b090fe64dbb5878f50281", "shasum": "" }, "require": { @@ -4811,7 +4811,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.5" + "source": "https://github.com/symfony/string/tree/v7.1.8" }, "funding": [ { @@ -4827,7 +4827,7 @@ "type": "tidelift" } ], - "time": "2024-09-20T08:28:38+00:00" + "time": "2024-11-13T13:31:21+00:00" }, { "name": "ta-tikoma/phpunit-architecture-test", @@ -4999,10 +4999,10 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform": {}, + "platform-dev": {}, + "plugin-api-version": "2.6.0" } diff --git a/src/App.php b/src/App.php index db1d5df..81d4f82 100644 --- a/src/App.php +++ b/src/App.php @@ -12,7 +12,10 @@ namespace Scrawler; +use Scrawler\Http\Request; +use Scrawler\Http\Response; use Scrawler\Router\Router; +use Scrawler\Factory\AppFactory; /** * @method \PHLAK\Config\Config config() @@ -25,9 +28,6 @@ class App use Traits\Container; use Traits\Router; - public static ?App $app = null; - - private Router $router; private \DI\Container $container; @@ -36,15 +36,14 @@ class App */ private array $handler = []; + private Request $request; + private Response $response; + private string $version = '2.x'; - public function __construct() + public function __construct(\DI\Container $container) { - self::$app = $this; - $this->router = new Router(); - $this->container = new \DI\Container(); - $this->register('config', value: $this->create(\PHLAK\Config\Config::class)); - $this->register('pipeline', value: $this->create(Pipeline::class)); + $this->container = $container; $this->config()->set('debug', false); $this->config()->set('api', false); $this->config()->set('middlewares', []); @@ -72,13 +71,19 @@ public function __construct() }); } - public static function engine(): self + public function request(): Request { - if (null == self::$app) { - self::$app = new self(); - } + return $this->request; + } - return self::$app; + public function response(): Response + { + return $this->response; + } + + public static function engine(): App + { + return AppFactory::getApp(); } /** @@ -119,11 +124,14 @@ public function getHandler(string $key): \Closure|callable public function dispatch(?Http\Request $request = null): Http\Response { if (is_null($request)) { - $request = $this->request(); + $request = Http\Request::createFromGlobals(); } + + $this->request = $request; + $pipeline = new Pipeline(); - return $pipeline->middleware($this->config()->get('middlewares'))->run($request, fn ($request): \Scrawler\Http\Response => $this->dispatchRouter($request)); + return $pipeline->middleware($this->config()->get('middlewares'))->run($request, fn ($request): Response => $this->dispatchRouter($request)); } /** @@ -133,21 +141,22 @@ private function dispatchRouter(Http\Request $request): Http\Response { $httpMethod = $request->getMethod(); $uri = $request->getPathInfo(); - $response = $this->makeResponse('', 200); + $this->response = $this->makeResponse('', 200); + try { - [$status, $handler, $args, $debug] = $this->router->dispatch($httpMethod, $uri); + [$status, $handler, $args, $debug] = $this->router()->dispatch($httpMethod, $uri); switch ($status) { case Router::NOT_FOUND: - $response = $this->handleNotFound($debug); + $this->response = $this->handleNotFound($debug); break; case Router::METHOD_NOT_ALLOWED: - $response = $this->handleMethodNotAllowed($debug); + $this->response = $this->handleMethodNotAllowed($debug); break; case Router::FOUND: // call the handler - $response = $this->container->call($handler, $args); - $response = $this->makeResponse($response, 200); + $response = $this->container->call($handler, ['request' => $request, ...$args]); + $this->response = $this->makeResponse($this->response, 200); // Send Response } } catch (\Exception $e) { @@ -155,7 +164,7 @@ private function dispatchRouter(Http\Request $request): Http\Response throw $e; } else { $response = $this->container->call($this->handler['500']); - $response = $this->makeResponse($response, 500); + $this->response = $this->makeResponse($response, 500); } } @@ -209,16 +218,16 @@ public function run(): void private function makeResponse(array|string|Http\Response $content, int $status = 200): Http\Response { if (!$content instanceof Http\Response) { - $response = new Http\Response(); - $response->setStatusCode($status); + $this->response = new Http\Response(); + $this->response->setStatusCode($status); if (is_array($content)) { $this->config()->set('api', true); - $response->json($content); + $this->response->json($content); } elseif ($this->config()->get('api')) { - $response->json($content); + $this->response->json($content); } else { - $response->setContent($content); + $this->response->setContent($content); } } else { $response = $content; diff --git a/src/Factory/AppFactory.php b/src/Factory/AppFactory.php new file mode 100644 index 0000000..8de9bd2 --- /dev/null +++ b/src/Factory/AppFactory.php @@ -0,0 +1,28 @@ +set('config', new \PHLAK\Config\Config()); + self::$container->set('pipeline', new \Scrawler\Pipeline()); + self::$container->set('router', new \Scrawler\Router\Router()); + } + $app = new App(self::$container); + self::$container->set('app', fn(): App=> $app); + return $app; + } + + public static function getApp(): App{ + if(!self::$container->has('app')){ + self::create(); + } + return self::$container->get('app'); + } +} \ No newline at end of file diff --git a/src/Traits/Router.php b/src/Traits/Router.php index d3bbbfd..116533c 100644 --- a/src/Traits/Router.php +++ b/src/Traits/Router.php @@ -17,7 +17,7 @@ trait Router */ public function registerAutoRoute(string $dir, string $namespace): void { - $this->router->register($dir, $namespace); + $this->router()->register($dir, $namespace); } /** @@ -26,7 +26,7 @@ public function registerAutoRoute(string $dir, string $namespace): void public function get(string $route, \Closure|callable $callback): void { $callback = \Closure::fromCallable(callback: $callback); - $this->router->get($route, $callback); + $this->router()->get($route, $callback); } /** @@ -35,7 +35,7 @@ public function get(string $route, \Closure|callable $callback): void public function post(string $route, \Closure|callable $callback): void { $callback = \Closure::fromCallable(callback: $callback); - $this->router->post($route, $callback); + $this->router()->post($route, $callback); } /** @@ -44,7 +44,7 @@ public function post(string $route, \Closure|callable $callback): void public function put(string $route, \Closure|callable $callback): void { $callback = \Closure::fromCallable(callback: $callback); - $this->router->put($route, $callback); + $this->router()->put($route, $callback); } /** @@ -53,7 +53,7 @@ public function put(string $route, \Closure|callable $callback): void public function delete(string $route, \Closure|callable $callback): void { $callback = \Closure::fromCallable(callback: $callback); - $this->router->delete($route, $callback); + $this->router()->delete($route, $callback); } /** diff --git a/tests/Unit/AppTest.php b/tests/Unit/AppTest.php index f495a02..5af51ff 100644 --- a/tests/Unit/AppTest.php +++ b/tests/Unit/AppTest.php @@ -1,7 +1,9 @@ registerAutoRoute(__DIR__.'/../Controllers', 'Tests\\Controllers'); $request = Scrawler\Http\Request::create( '/test', @@ -12,13 +14,13 @@ }); it('test container() function', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $container = $app->container(); expect($container)->toBeInstanceOf(DI\Container::class); }); it('tests if get() works', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->get('/test', fn (): string => 'Hello World'); $request = Scrawler\Http\Request::create( '/test', @@ -29,7 +31,7 @@ }); it('tests if post() works', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->post('/test/post', fn (): string => 'Hello World'); $request = Scrawler\Http\Request::create( '/test/post', @@ -40,7 +42,7 @@ }); it('tests if put() works', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->put('/test/put', fn (): string => 'Hello World'); $request = Scrawler\Http\Request::create( '/test/put', @@ -51,7 +53,7 @@ }); it('tests if delete() works', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->delete('/test/delete', fn (): string => 'Hello World'); $request = Scrawler\Http\Request::create( '/test/delete', @@ -62,7 +64,7 @@ }); it('tests if all() works', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->all('/test/all', fn (): string => 'Hello World'); $request = Scrawler\Http\Request::create( '/test/all', @@ -80,7 +82,7 @@ }); it('tests if register handler() works', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->handler('404', fn (): string => 'Its a custom 404'); $request = Scrawler\Http\Request::create( '/test/something', @@ -91,7 +93,7 @@ }); it('tests if getHandler() works', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->handler('404', fn (): string => 'Its a custom 404'); $handler = $app->getHandler('404'); @@ -99,7 +101,7 @@ }); it('tests if register() works', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $test = new Tests\Service\Test(); $app->register('test', $test); $test = app()->test()->test(); @@ -107,14 +109,14 @@ }); it('tests if register() throws error on override', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $test = new Tests\Service\Test(); $app->register('test', $test); $app->register('test', $test); })->throws(Scrawler\Exception\ContainerException::class); it('tests if register() lets force override', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $test = new Tests\Service\Test(); $app->register('test', $test); $app->register('test', $test, true); @@ -123,13 +125,13 @@ }); it('tests if register() stops core override', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $test = new Tests\Service\Test(); $app->register('config', $test, true); })->throws(Scrawler\Exception\ContainerException::class); it('tests default 404 in api mode', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->config()->set('api', true); $request = Scrawler\Http\Request::create( '/test/something', @@ -140,7 +142,7 @@ }); it('tests default 404 in web mode', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $request = Scrawler\Http\Request::create( '/test/something', 'GET', @@ -150,7 +152,7 @@ }); it('tests default 405 in api mode', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->config()->set('api', true); $app->registerAutoRoute(__DIR__.'/../Controllers', 'Tests\\Controllers'); @@ -163,7 +165,7 @@ }); it('tests default 405 in web mode', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->registerAutoRoute(__DIR__.'/../Controllers', 'Tests\\Controllers'); $request = Scrawler\Http\Request::create( '/test/test', @@ -174,7 +176,7 @@ }); it('tests default 500 in api mode', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->config()->set('api', true); $app->registerAutoRoute(__DIR__.'/../Controllers', 'Tests\\Controllers'); $request = Scrawler\Http\Request::create( @@ -186,7 +188,7 @@ }); it('tests default 500 in web mode', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->registerAutoRoute(__DIR__.'/../Controllers', 'Tests\\Controllers'); $request = Scrawler\Http\Request::create( '/test/exception', @@ -197,12 +199,12 @@ }); it('tests for ContainerException', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->someClass(); })->throws(Scrawler\Exception\ContainerException::class); it('tests for NotFoundException', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->config()->set('debug', true); $request = Scrawler\Http\Request::create( '/notfound', @@ -212,7 +214,7 @@ })->throws(Scrawler\Exception\NotFoundException::class); it('tests for MethodNotAllowedException', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->registerAutoRoute(__DIR__.'/../Controllers', 'Tests\\Controllers'); $app->config()->set('debug', true); $request = Scrawler\Http\Request::create( @@ -223,15 +225,14 @@ })->throws(Scrawler\Exception\MethodNotAllowedException::class); it('tests for json response in api mode ', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->config()->set('api', true); $app->get('/test', fn (): array => ['data' => 'Hello World']); $request = Scrawler\Http\Request::create( '/test', 'GET', ); - $app->register('request', $request); - $response = $app->dispatch(); + $response = $app->dispatch($request); expect($response->getContent())->toBe('{"data":"Hello World"}'); $app->get('/test/json', fn () => json_encode(['data' => 'Hello World'])); $request = Scrawler\Http\Request::create( @@ -243,7 +244,7 @@ }); it('tests when response is already a response object', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->get('/test', function (): Scrawler\Http\Response { $response = new Scrawler\Http\Response(); $response->setContent('Hello World'); @@ -259,13 +260,14 @@ }); it('tests function being called on __call()', function (): void { - $app = new Scrawler\App(); - $request = $app->request(); - expect($request)->toBeInstanceOf(Scrawler\Http\Request::class); + $app = AppFactory::create(); + $app->register('test', new Tests\Service\Test()); + + expect($app->test())->toBeInstanceOf(Tests\Service\Test::class); }); it('tests for make() function', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $app->register('test', Tests\Service\Test::class); $test = $app->make(Tests\Service\Test::class); $test = $test->test(); @@ -273,32 +275,14 @@ }); it('tests if call() works', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $result = $app->call(fn (): string => 'test function works'); expect($result)->toBe('test function works'); }); it('tests getVersion function', function (): void { - $app = new Scrawler\App(); + $app = AppFactory::create(); $version = $app->getVersion(); $this->assertStringContainsString('.x', $version); }); -it('tests for run() function ', function (): void { - $app = new Scrawler\App(); - $app->get('/test', function (): Scrawler\Http\Response { - $response = new Scrawler\Http\Response(); - $response->setContent('Hello World'); - - return $response; - }); - $request = Scrawler\Http\Request::create( - '/test', - 'GET', - ); - $app->register('request', $request); - ob_start(); - $app->run(); - $output = ob_get_clean(); - expect($output)->toBe('Hello World'); -}); diff --git a/tests/Unit/FunctionTest.php b/tests/Unit/FunctionTest.php index bf023a1..7e9496a 100644 --- a/tests/Unit/FunctionTest.php +++ b/tests/Unit/FunctionTest.php @@ -21,7 +21,6 @@ it('tests for env() function', function (): void { $_ENV['test'] = 'test'; expect(env('test'))->toBe('test'); - request()->server->set('test_s', 'test_s'); expect(env('test_s'))->toBe('test_s'); expect(env('random'))->toBe(null); putenv('test_put=test_put');