From 3e019d504b37753440b37ffad55c021eaef4c887 Mon Sep 17 00:00:00 2001 From: Mark Hamstra Date: Thu, 1 May 2025 18:43:36 +0200 Subject: [PATCH 01/15] Update patch dependencies --- composer.lock | 428 ++++++++++++++++++++++++++++---------------------- 1 file changed, 244 insertions(+), 184 deletions(-) diff --git a/composer.lock b/composer.lock index 5d0a67f..ea010d2 100644 --- a/composer.lock +++ b/composer.lock @@ -8,20 +8,20 @@ "packages": [ { "name": "caseyamcl/toc", - "version": "v3.1", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/caseyamcl/toc.git", - "reference": "1aa7d6b446e151b4c11d18b11c199e61d00c5182" + "reference": "5ecaad1e1c36bab5caa278e2b9dfc8bc420e6d51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/caseyamcl/toc/zipball/1aa7d6b446e151b4c11d18b11c199e61d00c5182", - "reference": "1aa7d6b446e151b4c11d18b11c199e61d00c5182", + "url": "https://api.github.com/repos/caseyamcl/toc/zipball/5ecaad1e1c36bab5caa278e2b9dfc8bc420e6d51", + "reference": "5ecaad1e1c36bab5caa278e2b9dfc8bc420e6d51", "shasum": "" }, "require": { - "cocur/slugify": "^3.0|^4.0", + "cocur/slugify": "^3.0|~4.4.0|^4.6", "ext-dom": "*", "knplabs/knp-menu": "^3.2", "masterminds/html5": "^2.1", @@ -63,22 +63,22 @@ ], "support": { "issues": "https://github.com/caseyamcl/toc/issues", - "source": "https://github.com/caseyamcl/toc/tree/v3.1" + "source": "https://github.com/caseyamcl/toc/tree/v3.2.0" }, - "time": "2022-03-16T15:46:12+00:00" + "time": "2024-12-08T16:12:05+00:00" }, { "name": "cocur/slugify", - "version": "v4.3.0", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/cocur/slugify.git", - "reference": "652234ef5f1be844a2ae1c36ad1b4c88b05160f9" + "reference": "4c6ed14a087ca061b220ffda640c07644946e2a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cocur/slugify/zipball/652234ef5f1be844a2ae1c36ad1b4c88b05160f9", - "reference": "652234ef5f1be844a2ae1c36ad1b4c88b05160f9", + "url": "https://api.github.com/repos/cocur/slugify/zipball/4c6ed14a087ca061b220ffda640c07644946e2a0", + "reference": "4c6ed14a087ca061b220ffda640c07644946e2a0", "shasum": "" }, "require": { @@ -137,9 +137,9 @@ ], "support": { "issues": "https://github.com/cocur/slugify/issues", - "source": "https://github.com/cocur/slugify/tree/v4.3.0" + "source": "https://github.com/cocur/slugify/tree/v4.4.0" }, - "time": "2022-12-07T19:48:48+00:00" + "time": "2023-08-05T09:42:11+00:00" }, { "name": "knplabs/knp-menu", @@ -308,26 +308,24 @@ }, { "name": "masterminds/html5", - "version": "2.7.6", + "version": "2.9.0", "source": { "type": "git", "url": "https://github.com/Masterminds/html5-php.git", - "reference": "897eb517a343a2281f11bc5556d6548db7d93947" + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/897eb517a343a2281f11bc5556d6548db7d93947", - "reference": "897eb517a343a2281f11bc5556d6548db7d93947", + "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", "shasum": "" }, "require": { - "ext-ctype": "*", "ext-dom": "*", - "ext-libxml": "*", "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7" + "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" }, "type": "library", "extra": { @@ -371,9 +369,9 @@ ], "support": { "issues": "https://github.com/Masterminds/html5-php/issues", - "source": "https://github.com/Masterminds/html5-php/tree/2.7.6" + "source": "https://github.com/Masterminds/html5-php/tree/2.9.0" }, - "time": "2022-08-18T16:18:26+00:00" + "time": "2024-03-31T07:05:07+00:00" }, { "name": "nikic/fast-route", @@ -427,30 +425,30 @@ }, { "name": "phpoption/phpoption", - "version": "1.9.0", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab" + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", - "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8", - "phpunit/phpunit": "^8.5.28 || ^9.5.21" + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" }, "type": "library", "extra": { "bamarni-bin": { "bin-links": true, - "forward-command": true + "forward-command": false }, "branch-alias": { "dev-master": "1.9-dev" @@ -486,7 +484,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.0" + "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" }, "funding": [ { @@ -498,7 +496,7 @@ "type": "tidelift" } ], - "time": "2022-07-30T15:51:26+00:00" + "time": "2024-07-20T21:41:07+00:00" }, { "name": "pimple/pimple", @@ -603,25 +601,25 @@ }, { "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": { @@ -650,9 +648,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": "slim/php-view", @@ -709,16 +707,16 @@ }, { "name": "slim/slim", - "version": "3.12.4", + "version": "3.12.5", "source": { "type": "git", "url": "https://github.com/slimphp/Slim.git", - "reference": "ce3cb65a06325fc9fe3d0223f2ae23113a767304" + "reference": "565632b2d9b64ecedf89546edbbf4f3648089f0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/ce3cb65a06325fc9fe3d0223f2ae23113a767304", - "reference": "ce3cb65a06325fc9fe3d0223f2ae23113a767304", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/565632b2d9b64ecedf89546edbbf4f3648089f0c", + "reference": "565632b2d9b64ecedf89546edbbf4f3648089f0c", "shasum": "" }, "require": { @@ -780,7 +778,7 @@ ], "support": { "issues": "https://github.com/slimphp/Slim/issues", - "source": "https://github.com/slimphp/Slim/tree/3.12.4" + "source": "https://github.com/slimphp/Slim/tree/3.12.5" }, "funding": [ { @@ -792,7 +790,7 @@ "type": "tidelift" } ], - "time": "2021-10-02T19:38:22+00:00" + "time": "2023-07-23T04:32:51+00:00" }, { "name": "slim/twig-view", @@ -851,21 +849,21 @@ }, { "name": "spatie/yaml-front-matter", - "version": "2.0.7", + "version": "2.0.9", "source": { "type": "git", "url": "https://github.com/spatie/yaml-front-matter.git", - "reference": "f49f228994de70827ca857efffdd3bd7703aea34" + "reference": "cbe67e1cdd0a29a96d74ccab9400fe663e078392" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/yaml-front-matter/zipball/f49f228994de70827ca857efffdd3bd7703aea34", - "reference": "f49f228994de70827ca857efffdd3bd7703aea34", + "url": "https://api.github.com/repos/spatie/yaml-front-matter/zipball/cbe67e1cdd0a29a96d74ccab9400fe663e078392", + "reference": "cbe67e1cdd0a29a96d74ccab9400fe663e078392", "shasum": "" }, "require": { "php": "^7.0|^8.0", - "symfony/yaml": "^3.0|^4.0|^5.0|^6.0" + "symfony/yaml": "^3.0|^4.0|^5.0|^6.0|^7.0" }, "require-dev": { "phpunit/phpunit": "^9.0" @@ -897,7 +895,7 @@ "yaml" ], "support": { - "source": "https://github.com/spatie/yaml-front-matter/tree/2.0.7" + "source": "https://github.com/spatie/yaml-front-matter/tree/2.0.9" }, "funding": [ { @@ -909,20 +907,20 @@ "type": "github" } ], - "time": "2022-04-06T12:03:55+00:00" + "time": "2024-06-13T10:20:51+00:00" }, { "name": "symfony/console", - "version": "v5.4.19", + "version": "v5.4.47", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740" + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740", + "url": "https://api.github.com/repos/symfony/console/zipball/c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", "shasum": "" }, "require": { @@ -987,12 +985,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.19" + "source": "https://github.com/symfony/console/tree/v5.4.47" }, "funding": [ { @@ -1008,20 +1006,20 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2024-11-06T11:30:55+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918", + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918", "shasum": "" }, "require": { @@ -1029,12 +1027,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -1059,7 +1057,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.4" }, "funding": [ { @@ -1075,24 +1073,24 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "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/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -1102,12 +1100,9 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1141,7 +1136,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" }, "funding": [ { @@ -1157,36 +1152,33 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" }, "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/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1222,7 +1214,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.31.0" }, "funding": [ { @@ -1238,36 +1230,33 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "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/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1306,7 +1295,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.31.0" }, "funding": [ { @@ -1322,24 +1311,24 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "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/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -1349,12 +1338,9 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1389,7 +1375,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -1405,33 +1391,30 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1468,7 +1451,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.31.0" }, "funding": [ { @@ -1484,33 +1467,30 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" }, "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/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1551,7 +1531,83 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" }, "funding": [ { @@ -1567,20 +1623,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/process", - "version": "v5.4.19", + "version": "v5.4.47", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "c5ba874c9b636dbccf761e22ce750e88ec3f55e1" + "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/c5ba874c9b636dbccf761e22ce750e88ec3f55e1", - "reference": "c5ba874c9b636dbccf761e22ce750e88ec3f55e1", + "url": "https://api.github.com/repos/symfony/process/zipball/5d1662fb32ebc94f17ddb8d635454a776066733d", + "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d", "shasum": "" }, "require": { @@ -1613,7 +1669,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.19" + "source": "https://github.com/symfony/process/tree/v5.4.47" }, "funding": [ { @@ -1629,20 +1685,20 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2024-11-06T11:36:42+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f37b419f7aea2e9abf10abd261832cace12e3300", + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300", "shasum": "" }, "require": { @@ -1658,12 +1714,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -1696,7 +1752,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.4" }, "funding": [ { @@ -1712,20 +1768,20 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/string", - "version": "v5.4.19", + "version": "v5.4.47", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb" + "reference": "136ca7d72f72b599f2631aca474a4f8e26719799" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/0a01071610fd861cc160dfb7e2682ceec66064cb", - "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb", + "url": "https://api.github.com/repos/symfony/string/zipball/136ca7d72f72b599f2631aca474a4f8e26719799", + "reference": "136ca7d72f72b599f2631aca474a4f8e26719799", "shasum": "" }, "require": { @@ -1782,7 +1838,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.19" + "source": "https://github.com/symfony/string/tree/v5.4.47" }, "funding": [ { @@ -1798,20 +1854,20 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2024-11-10T20:33:58+00:00" }, { "name": "symfony/yaml", - "version": "v5.4.19", + "version": "v5.4.45", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "71c05db20cb9b54d381a28255f17580e2b7e36a5" + "reference": "a454d47278cc16a5db371fe73ae66a78a633371e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/71c05db20cb9b54d381a28255f17580e2b7e36a5", - "reference": "71c05db20cb9b54d381a28255f17580e2b7e36a5", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a454d47278cc16a5db371fe73ae66a78a633371e", + "reference": "a454d47278cc16a5db371fe73ae66a78a633371e", "shasum": "" }, "require": { @@ -1857,7 +1913,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.19" + "source": "https://github.com/symfony/yaml/tree/v5.4.45" }, "funding": [ { @@ -1873,38 +1929,42 @@ "type": "tidelift" } ], - "time": "2023-01-10T18:51:14+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "twig/twig", - "version": "v3.5.1", + "version": "v3.11.3", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "a6e0510cc793912b451fd40ab983a1d28f611c15" + "reference": "3b06600ff3abefaf8ff55d5c336cd1c4253f8c7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/a6e0510cc793912b451fd40ab983a1d28f611c15", - "reference": "a6e0510cc793912b451fd40ab983a1d28f611c15", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/3b06600ff3abefaf8ff55d5c336cd1c4253f8c7e", + "reference": "3b06600ff3abefaf8ff55d5c336cd1c4253f8c7e", "shasum": "" }, "require": { "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3" + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php80": "^1.22", + "symfony/polyfill-php81": "^1.29" }, "require-dev": { - "psr/container": "^1.0", - "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" + "psr/container": "^1.0|^2.0", + "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.5-dev" - } - }, "autoload": { + "files": [ + "src/Resources/core.php", + "src/Resources/debug.php", + "src/Resources/escaper.php", + "src/Resources/string_loader.php" + ], "psr-4": { "Twig\\": "src/" } @@ -1937,7 +1997,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.5.1" + "source": "https://github.com/twigphp/Twig/tree/v3.11.3" }, "funding": [ { @@ -1949,7 +2009,7 @@ "type": "tidelift" } ], - "time": "2023-02-08T07:49:20+00:00" + "time": "2024-11-07T12:34:41+00:00" }, { "name": "vlucas/phpdotenv", @@ -2096,5 +2156,5 @@ "platform-overrides": { "php": "7.4.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } From 22b4179055ad0f705e7b5ac99e2345d7caf7a983 Mon Sep 17 00:00:00 2001 From: Mark Hamstra Date: Thu, 1 May 2025 19:14:13 +0200 Subject: [PATCH 02/15] Major upgrade to Commonmark 2.6 --- composer.json | 2 +- composer.lock | 415 ++++++++++++++++++++++++-- src/Helpers/LinkRenderer.php | 42 +-- src/Helpers/RelativeImageRenderer.php | 47 +-- src/Model/Page.php | 37 ++- 5 files changed, 467 insertions(+), 76 deletions(-) diff --git a/composer.json b/composer.json index df397fe..b1d28c2 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "slim/php-view": "^2.0", "slim/twig-view": "^2.3", "spatie/yaml-front-matter": "^2.0", - "league/commonmark": "^1.5", + "league/commonmark": "^2.6", "caseyamcl/toc": "^3.0", "vlucas/phpdotenv": "^3.3", "symfony/console": "^5.2", diff --git a/composer.lock b/composer.lock index ea010d2..bb5d7de 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": "309a5cc08a51d2a8c2e9b29f9e585805", + "content-hash": "dc2f387fb6eef80b5aa04da6a31a4533", "packages": [ { "name": "caseyamcl/toc", @@ -141,6 +141,81 @@ }, "time": "2023-08-05T09:42:11+00:00" }, + { + "name": "dflydev/dot-access-data", + "version": "v3.0.3", + "source": { + "type": "git", + "url": "https://github.com/dflydev/dflydev-dot-access-data.git", + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/a23a2bf4f31d3518f3ecb38660c95715dfead60f", + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.42", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.3", + "scrutinizer/ocular": "1.6.0", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dflydev\\DotAccessData\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dragonfly Development Inc.", + "email": "info@dflydev.com", + "homepage": "http://dflydev.com" + }, + { + "name": "Beau Simensen", + "email": "beau@dflydev.com", + "homepage": "http://beausimensen.com" + }, + { + "name": "Carlos Frutos", + "email": "carlos@kiwing.it", + "homepage": "https://github.com/cfrutos" + }, + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com" + } + ], + "description": "Given a deep data structure, access data by dot notation.", + "homepage": "https://github.com/dflydev/dflydev-dot-access-data", + "keywords": [ + "access", + "data", + "dot", + "notation" + ], + "support": { + "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", + "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3" + }, + "time": "2024-07-08T12:26:09+00:00" + }, { "name": "knplabs/knp-menu", "version": "v3.3.0", @@ -215,42 +290,55 @@ }, { "name": "league/commonmark", - "version": "1.6.7", + "version": "2.6.2", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b" + "reference": "06c3b0bf2540338094575612f4a1778d0d2d5e94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/2b8185c13bc9578367a5bf901881d1c1b5bbd09b", - "reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/06c3b0bf2540338094575612f4a1778d0d2d5e94", + "reference": "06c3b0bf2540338094575612f4a1778d0d2d5e94", "shasum": "" }, "require": { "ext-mbstring": "*", - "php": "^7.1 || ^8.0" - }, - "conflict": { - "scrutinizer/ocular": "1.7.*" + "league/config": "^1.1.1", + "php": "^7.4 || ^8.0", + "psr/event-dispatcher": "^1.0", + "symfony/deprecation-contracts": "^2.1 || ^3.0", + "symfony/polyfill-php80": "^1.16" }, "require-dev": { - "cebe/markdown": "~1.0", - "commonmark/commonmark.js": "0.29.2", - "erusev/parsedown": "~1.0", + "cebe/markdown": "^1.0", + "commonmark/cmark": "0.31.1", + "commonmark/commonmark.js": "0.31.1", + "composer/package-versions-deprecated": "^1.8", + "embed/embed": "^4.4", + "erusev/parsedown": "^1.0", "ext-json": "*", "github/gfm": "0.29.0", - "michelf/php-markdown": "~1.4", - "mikehaertl/php-shellcommand": "^1.4", - "phpstan/phpstan": "^0.12.90", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.2", - "scrutinizer/ocular": "^1.5", - "symfony/finder": "^4.2" + "michelf/php-markdown": "^1.4 || ^2.0", + "nyholm/psr7": "^1.5", + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0", + "scrutinizer/ocular": "^1.8.1", + "symfony/finder": "^5.3 | ^6.0 | ^7.0", + "symfony/process": "^5.4 | ^6.0 | ^7.0", + "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 | ^7.0", + "unleashedtech/php-coding-standard": "^3.1.1", + "vimeo/psalm": "^4.24.0 || ^5.0.0" + }, + "suggest": { + "symfony/yaml": "v2.3+ required if using the Front Matter extension" }, - "bin": [ - "bin/commonmark" - ], "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.7-dev" + } + }, "autoload": { "psr-4": { "League\\CommonMark\\": "src" @@ -268,7 +356,7 @@ "role": "Lead Developer" } ], - "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and Github-Flavored Markdown (GFM)", + "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)", "homepage": "https://commonmark.thephpleague.com", "keywords": [ "commonmark", @@ -282,6 +370,7 @@ ], "support": { "docs": "https://commonmark.thephpleague.com/", + "forum": "https://github.com/thephpleague/commonmark/discussions", "issues": "https://github.com/thephpleague/commonmark/issues", "rss": "https://github.com/thephpleague/commonmark/releases.atom", "source": "https://github.com/thephpleague/commonmark" @@ -304,7 +393,89 @@ "type": "tidelift" } ], - "time": "2022-01-13T17:18:13+00:00" + "time": "2025-04-18T21:09:27+00:00" + }, + { + "name": "league/config", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/config.git", + "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/config/zipball/754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", + "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", + "shasum": "" + }, + "require": { + "dflydev/dot-access-data": "^3.0.1", + "nette/schema": "^1.2", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.5", + "scrutinizer/ocular": "^1.8.1", + "unleashedtech/php-coding-standard": "^3.1", + "vimeo/psalm": "^4.7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Config\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Define configuration arrays with strict schemas and access values with dot notation", + "homepage": "https://config.thephpleague.com", + "keywords": [ + "array", + "config", + "configuration", + "dot", + "dot-access", + "nested", + "schema" + ], + "support": { + "docs": "https://config.thephpleague.com/", + "issues": "https://github.com/thephpleague/config/issues", + "rss": "https://github.com/thephpleague/config/releases.atom", + "source": "https://github.com/thephpleague/config" + }, + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + } + ], + "time": "2022-12-11T20:36:23+00:00" }, { "name": "masterminds/html5", @@ -373,6 +544,154 @@ }, "time": "2024-03-31T07:05:07+00:00" }, + { + "name": "nette/schema", + "version": "v1.2.5", + "source": { + "type": "git", + "url": "https://github.com/nette/schema.git", + "reference": "0462f0166e823aad657c9224d0f849ecac1ba10a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/schema/zipball/0462f0166e823aad657c9224d0f849ecac1ba10a", + "reference": "0462f0166e823aad657c9224d0f849ecac1ba10a", + "shasum": "" + }, + "require": { + "nette/utils": "^2.5.7 || ^3.1.5 || ^4.0", + "php": "7.1 - 8.3" + }, + "require-dev": { + "nette/tester": "^2.3 || ^2.4", + "phpstan/phpstan-nette": "^1.0", + "tracy/tracy": "^2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "📐 Nette Schema: validating data structures against a given Schema.", + "homepage": "https://nette.org", + "keywords": [ + "config", + "nette" + ], + "support": { + "issues": "https://github.com/nette/schema/issues", + "source": "https://github.com/nette/schema/tree/v1.2.5" + }, + "time": "2023-10-05T20:37:59+00:00" + }, + { + "name": "nette/utils", + "version": "v3.2.10", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "a4175c62652f2300c8017fb7e640f9ccb11648d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/a4175c62652f2300c8017fb7e640f9ccb11648d2", + "reference": "a4175c62652f2300c8017fb7e640f9ccb11648d2", + "shasum": "" + }, + "require": { + "php": ">=7.2 <8.4" + }, + "conflict": { + "nette/di": "<3.0.6" + }, + "require-dev": { + "jetbrains/phpstorm-attributes": "dev-master", + "nette/tester": "~2.0", + "phpstan/phpstan": "^1.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "support": { + "issues": "https://github.com/nette/utils/issues", + "source": "https://github.com/nette/utils/tree/v3.2.10" + }, + "time": "2023-07-30T15:38:18+00:00" + }, { "name": "nikic/fast-route", "version": "v1.3.0", @@ -599,6 +918,56 @@ }, "time": "2021-11-05T16:50:12+00:00" }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, { "name": "psr/http-message", "version": "1.1", diff --git a/src/Helpers/LinkRenderer.php b/src/Helpers/LinkRenderer.php index 213b0b4..1b9fce5 100644 --- a/src/Helpers/LinkRenderer.php +++ b/src/Helpers/LinkRenderer.php @@ -2,19 +2,22 @@ namespace MODXDocs\Helpers; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Element\Link; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; +use League\CommonMark\Extension\CommonMark\Node\Inline\Link; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; use MODXDocs\Exceptions\RedirectNotFoundException; use MODXDocs\Services\VersionsService; -class LinkRenderer implements InlineRendererInterface +class LinkRenderer implements NodeRendererInterface, ConfigurationAwareInterface { protected $baseUri; protected $currentDoc; + protected $config; public function __construct($baseUri, $currentDoc) { @@ -22,16 +25,20 @@ public function __construct($baseUri, $currentDoc) $this->currentDoc = $currentDoc; } - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) + public function setConfiguration(ConfigurationInterface $configuration): void { - if (!($inline instanceof Link)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); + $this->config = $configuration; + } + + public function render(Node $node, ChildNodeRendererInterface $childRenderer) + { + if (!($node instanceof Link)) { + throw new \InvalidArgumentException('Incompatible node type: ' . \get_class($node)); } - $href = $this->getHref($inline->getUrl()); - $attributes = [ - 'href' => $href, - ]; + $href = $this->getHref($node->getUrl()); + $attributes = $node->data->get('attributes', []); + $attributes['href'] = $href; // Handle hashes in links $hash = ''; @@ -41,12 +48,11 @@ public function render(AbstractInline $inline, ElementRendererInterface $htmlRen $href = substr($href, 0, $hashPosition); } - - if (isset($inline->attributes['title']) && $inline->attributes['title'] !== '') { - $attributes['title'] = $htmlRenderer->escape($inline->data['title'], true); + if (($title = $node->data->get('title', null)) !== null && $title !== '') { + $attributes['title'] = $title; } - if (static::isExternalUrl($inline->getUrl())) { + if (static::isExternalUrl($node->getUrl())) { $attributes['class'] = 'is-externallink'; $attributes['target'] = '_blank'; $attributes['rel'] = 'noreferrer noopener'; @@ -64,7 +70,7 @@ public function render(AbstractInline $inline, ElementRendererInterface $htmlRen } } - return new HtmlElement('a', $attributes, $htmlRenderer->renderInlines($inline->children())); + return new HtmlElement('a', $attributes, $childRenderer->renderNodes($node->children())); } private function getHref($url) diff --git a/src/Helpers/RelativeImageRenderer.php b/src/Helpers/RelativeImageRenderer.php index 8db9e50..f63fc02 100644 --- a/src/Helpers/RelativeImageRenderer.php +++ b/src/Helpers/RelativeImageRenderer.php @@ -2,41 +2,45 @@ namespace MODXDocs\Helpers; -use League\CommonMark\ElementRendererInterface; -use League\CommonMark\HtmlElement; -use League\CommonMark\Inline\Element\AbstractInline; -use League\CommonMark\Inline\Element\Image; -use League\CommonMark\Inline\Renderer\InlineRendererInterface; +use League\CommonMark\Extension\CommonMark\Node\Inline\Image; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; use League\CommonMark\Util\RegexHelper; -use League\CommonMark\Util\Xml; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; -class RelativeImageRenderer implements InlineRendererInterface +class RelativeImageRenderer implements NodeRendererInterface, ConfigurationAwareInterface { private $relativeFilePath; + private $config; public function __construct($relativeFilePath) { $this->relativeFilePath = $relativeFilePath; } + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + /** - * @param Image $inline - * @param ElementRendererInterface $htmlRenderer + * @param Image $node + * @param ChildNodeRendererInterface $childRenderer * * @return HtmlElement */ - public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) + public function render(Node $node, ChildNodeRendererInterface $childRenderer) { - if (!($inline instanceof Image)) { - throw new \InvalidArgumentException('Incompatible inline type: ' . get_class($inline)); + if (!($node instanceof Image)) { + throw new \InvalidArgumentException('Incompatible node type: ' . get_class($node)); } - $attrs = []; - foreach ($inline->getData('attributes', []) as $key => $value) { - $attrs[$key] = Xml::escape($value, true); - } + $attrs = $node->data->get('attributes', []); - $url = $inline->getUrl(); + $url = $node->getUrl(); $path = '/' . dirname($this->relativeFilePath) . '/'; $imageIsRelative = strpos($url, '/') !== 0 && strpos($url, 'http') !== 0; @@ -47,17 +51,16 @@ public function render(AbstractInline $inline, ElementRendererInterface $htmlRen if (RegexHelper::isLinkPotentiallyUnsafe($url)) { $url = ''; } - $attrs['src'] = Xml::escape($url, true); + $attrs['src'] = $url; - $alt = $htmlRenderer->renderInlines($inline->children()); + $alt = $childRenderer->renderNodes($node->children()); $alt = preg_replace('/\<[^>]*alt="([^"]*)"[^>]*\>/', '$1', $alt); $attrs['alt'] = preg_replace('/\<[^>]*\>/', '', $alt); - if (isset($inline->data['title'])) { - $attrs['title'] = Xml::escape($inline->data['title'], true); + if ($title = $node->data->get('title', null)) { + $attrs['title'] = $title; } return new HtmlElement('img', $attrs, '', true); } - } diff --git a/src/Model/Page.php b/src/Model/Page.php index 367f7c8..cc1b8ee 100644 --- a/src/Model/Page.php +++ b/src/Model/Page.php @@ -4,9 +4,13 @@ namespace MODXDocs\Model; use Knp\Menu\Matcher\Matcher; -use League\CommonMark\CommonMarkConverter; -use League\CommonMark\Environment; +use League\CommonMark\Environment\Environment; +use League\CommonMark\Exception\CommonMarkException; +use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; use League\CommonMark\Extension\Table\TableExtension; +use League\CommonMark\Extension\CommonMark\Node\Inline\Link; +use League\CommonMark\Extension\CommonMark\Node\Inline\Image; +use League\CommonMark\MarkdownConverter; use MODXDocs\Exceptions\NotFoundException; use MODXDocs\Helpers\LinkRenderer; use MODXDocs\Helpers\MarkupFixer; @@ -18,8 +22,6 @@ use PDO; use Symfony\Component\Process\Process; use TOC\TocGenerator; -use League\CommonMark\Inline\Element\Image; -use League\CommonMark\Inline\Element\Link; class Page { @@ -92,26 +94,37 @@ private function renderBody(): void return; } - // Grab the markdown - $environment = Environment::createCommonMarkEnvironment(); + // Parse the markdown + $environment = new Environment([ + 'html_input' => 'allow', + 'max_nesting_level' => 10, + 'allow_unsafe_links' => false, + + ]); + $environment->addExtension(new CommonMarkCoreExtension()); $environment->addExtension(new TableExtension()); - $environment->addInlineRenderer(Link::class, + $environment->addRenderer( + Link::class, new LinkRenderer( '/' . $this->version . '/' . $this->language . '/', $this->currentUrl ) ); - $environment->addInlineRenderer(Image::class, + $environment->addRenderer( + Image::class, new RelativeImageRenderer( $this->relativeFilePath ) ); - $markdown = new CommonMarkConverter([ - 'html_input' => 'allow', - ], $environment); + $converter = new MarkdownConverter($environment); - $content = $markdown->convertToHtml($this->body); + try { + $content = $converter->convert($this->body)->getContent(); + } catch (CommonMarkException $e) { + $content = '

There was an error parsing this document. Below is the source markdown.

'; + $content .= '
' . $this->body . '
'; + } $fixer = new MarkupFixer(); $this->renderedBody = $fixer->fix($content); From 0b7bc8025c7f6d0a11468338aa055e9bbef1d5b3 Mon Sep 17 00:00:00 2001 From: Mark Hamstra Date: Thu, 1 May 2025 20:55:00 +0200 Subject: [PATCH 03/15] Apply Slim4 and other major version upgrades --- composer.json | 11 +- composer.lock | 1182 +++++++++++++++++++++---- public/index.php | 4 + public/update-cron.php | 2 +- public/update.php | 2 +- src/CLI/Commands/CacheRefresh.php | 2 +- src/CLI/Commands/ScrapeImages.php | 4 - src/Containers/DB.php | 6 +- src/Containers/ErrorHandlers.php | 46 +- src/Containers/Logger.php | 20 +- src/Containers/Services.php | 29 +- src/Containers/View.php | 30 +- src/DocsApp.php | 144 ++- src/Helpers/LinkRenderer.php | 2 +- src/Helpers/Redirector.php | 2 +- src/Helpers/SettingsParser.php | 4 +- src/Middlewares/RequestMiddleware.php | 17 +- src/Model/Page.php | 20 +- src/Model/PageRequest.php | 3 +- src/Model/SearchResults.php | 2 + src/Navigation/Tree.php | 2 +- src/Services/CacheService.php | 4 +- src/Services/FilePathService.php | 6 +- src/Services/TranslationService.php | 13 +- src/Services/VersionsService.php | 94 +- src/Twig/DocExtensions.php | 14 +- src/Views/Base.php | 111 +-- src/Views/Doc.php | 19 +- src/Views/Error.php | 9 +- src/Views/NotFound.php | 9 +- src/Views/Search.php | 31 +- src/Views/Stats/NotFoundRequests.php | 22 +- src/Views/Stats/Searches.php | 25 +- templates/documentation.twig | 8 +- templates/layout.twig | 4 +- templates/notfound.twig | 2 +- templates/search.twig | 2 +- templates/search_ajax.twig | 4 +- tests/BaseTestCase.php | 6 +- 39 files changed, 1377 insertions(+), 540 deletions(-) diff --git a/composer.json b/composer.json index b1d28c2..bdfc868 100644 --- a/composer.json +++ b/composer.json @@ -18,13 +18,16 @@ "ext-sqlite3": "*", "ext-fileinfo": "*", "ext-mbstring": "*", - "slim/slim": "^3.1", - "slim/php-view": "^2.0", - "slim/twig-view": "^2.3", + "slim/slim": "^4.0", + "slim/psr7": "^1.6", + "php-di/php-di": "^6.4", + "monolog/monolog": "^2.0", + "slim/php-view": "^3.0", + "slim/twig-view": "^3.0", "spatie/yaml-front-matter": "^2.0", "league/commonmark": "^2.6", "caseyamcl/toc": "^3.0", - "vlucas/phpdotenv": "^3.3", + "vlucas/phpdotenv": "^5.6", "symfony/console": "^5.2", "symfony/process": "^5.2", "voku/stop-words": "^2.0" diff --git a/composer.lock b/composer.lock index bb5d7de..5a0f70d 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": "dc2f387fb6eef80b5aa04da6a31a4533", + "content-hash": "39e320529a079f25aaaf602dad8420a5", "packages": [ { "name": "caseyamcl/toc", @@ -216,6 +216,124 @@ }, "time": "2024-07-08T12:26:09+00:00" }, + { + "name": "fig/http-message-util", + "version": "1.1.5", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message-util.git", + "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message-util/zipball/9d94dc0154230ac39e5bf89398b324a86f63f765", + "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0 || ^8.0" + }, + "suggest": { + "psr/http-message": "The package containing the PSR-7 interfaces" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fig\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Utility classes and constants for use with PSR-7 (psr/http-message)", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "issues": "https://github.com/php-fig/http-message-util/issues", + "source": "https://github.com/php-fig/http-message-util/tree/1.1.5" + }, + "time": "2020-11-24T22:02:12+00:00" + }, + { + "name": "graham-campbell/result-type", + "version": "v1.1.3", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.3" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" + }, + "type": "library", + "autoload": { + "psr-4": { + "GrahamCampbell\\ResultType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "An Implementation Of The Result Type", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" + ], + "support": { + "issues": "https://github.com/GrahamCampbell/Result-Type/issues", + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" + } + ], + "time": "2024-07-20T21:45:45+00:00" + }, { "name": "knplabs/knp-menu", "version": "v3.3.0", @@ -288,6 +406,67 @@ }, "time": "2021-10-23T15:01:04+00:00" }, + { + "name": "laravel/serializable-closure", + "version": "v1.3.7", + "source": { + "type": "git", + "url": "https://github.com/laravel/serializable-closure.git", + "reference": "4f48ade902b94323ca3be7646db16209ec76be3d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/4f48ade902b94323ca3be7646db16209ec76be3d", + "reference": "4f48ade902b94323ca3be7646db16209ec76be3d", + "shasum": "" + }, + "require": { + "php": "^7.3|^8.0" + }, + "require-dev": { + "illuminate/support": "^8.0|^9.0|^10.0|^11.0", + "nesbot/carbon": "^2.61|^3.0", + "pestphp/pest": "^1.21.3", + "phpstan/phpstan": "^1.8.2", + "symfony/var-dumper": "^5.4.11|^6.2.0|^7.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Laravel\\SerializableClosure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + }, + { + "name": "Nuno Maduro", + "email": "nuno@laravel.com" + } + ], + "description": "Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.", + "keywords": [ + "closure", + "laravel", + "serializable" + ], + "support": { + "issues": "https://github.com/laravel/serializable-closure/issues", + "source": "https://github.com/laravel/serializable-closure" + }, + "time": "2024-11-14T18:34:49+00:00" + }, { "name": "league/commonmark", "version": "2.6.2", @@ -544,6 +723,108 @@ }, "time": "2024-03-31T07:05:07+00:00" }, + { + "name": "monolog/monolog", + "version": "2.10.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "5cf826f2991858b54d5c3809bee745560a1042a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/5cf826f2991858b54d5c3809bee745560a1042a7", + "reference": "5cf826f2991858b54d5c3809bee745560a1042a7", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" + }, + "provide": { + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^7 || ^8", + "ext-json": "*", + "graylog2/gelf-php": "^1.4.2 || ^2@dev", + "guzzlehttp/guzzle": "^7.4", + "guzzlehttp/psr7": "^2.2", + "mongodb/mongodb": "^1.8", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "phpspec/prophecy": "^1.15", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8.5.38 || ^9.6.19", + "predis/predis": "^1.1 || ^2.0", + "rollbar/rollbar": "^1.3 || ^2 || ^3", + "ruflin/elastica": "^7", + "swiftmailer/swiftmailer": "^5.3|^6.0", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "https://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/2.10.0" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "time": "2024-11-12T12:43:37+00:00" + }, { "name": "nette/schema", "version": "v1.2.5", @@ -723,130 +1004,506 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ], + "support": { + "issues": "https://github.com/nikic/FastRoute/issues", + "source": "https://github.com/nikic/FastRoute/tree/master" + }, + "time": "2018-02-13T20:26:39+00:00" + }, + { + "name": "php-di/invoker", + "version": "2.3.6", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/Invoker.git", + "reference": "59f15608528d8a8838d69b422a919fd6b16aa576" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/59f15608528d8a8838d69b422a919fd6b16aa576", + "reference": "59f15608528d8a8838d69b422a919fd6b16aa576", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "psr/container": "^1.0|^2.0" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "mnapoli/hard-mode": "~0.3.0", + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Invoker\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Generic and extensible callable invoker", + "homepage": "https://github.com/PHP-DI/Invoker", + "keywords": [ + "callable", + "dependency", + "dependency-injection", + "injection", + "invoke", + "invoker" + ], + "support": { + "issues": "https://github.com/PHP-DI/Invoker/issues", + "source": "https://github.com/PHP-DI/Invoker/tree/2.3.6" + }, + "funding": [ + { + "url": "https://github.com/mnapoli", + "type": "github" + } + ], + "time": "2025-01-17T12:49:27+00:00" + }, + { + "name": "php-di/php-di", + "version": "6.4.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/PHP-DI.git", + "reference": "ae0f1b3b03d8b29dff81747063cbfd6276246cc4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/ae0f1b3b03d8b29dff81747063cbfd6276246cc4", + "reference": "ae0f1b3b03d8b29dff81747063cbfd6276246cc4", + "shasum": "" + }, + "require": { + "laravel/serializable-closure": "^1.0", + "php": ">=7.4.0", + "php-di/invoker": "^2.0", + "php-di/phpdoc-reader": "^2.0.1", + "psr/container": "^1.0" + }, + "provide": { + "psr/container-implementation": "^1.0" + }, + "require-dev": { + "doctrine/annotations": "~1.10", + "friendsofphp/php-cs-fixer": "^2.4", + "mnapoli/phpunit-easymock": "^1.2", + "ocramius/proxy-manager": "^2.11.2", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^9.5" + }, + "suggest": { + "doctrine/annotations": "Install it if you want to use annotations (version ~1.2)", + "ocramius/proxy-manager": "Install it if you want to use lazy injection (version ~2.0)" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "DI\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The dependency injection container for humans", + "homepage": "https://php-di.org/", + "keywords": [ + "PSR-11", + "container", + "container-interop", + "dependency injection", + "di", + "ioc", + "psr11" + ], + "support": { + "issues": "https://github.com/PHP-DI/PHP-DI/issues", + "source": "https://github.com/PHP-DI/PHP-DI/tree/6.4.0" + }, + "funding": [ + { + "url": "https://github.com/mnapoli", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/php-di/php-di", + "type": "tidelift" + } + ], + "time": "2022-04-09T16:46:38+00:00" + }, + { + "name": "php-di/phpdoc-reader", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/PhpDocReader.git", + "reference": "66daff34cbd2627740ffec9469ffbac9f8c8185c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/PhpDocReader/zipball/66daff34cbd2627740ffec9469ffbac9f8c8185c", + "reference": "66daff34cbd2627740ffec9469ffbac9f8c8185c", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "require-dev": { + "mnapoli/hard-mode": "~0.3.0", + "phpunit/phpunit": "^8.5|^9.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpDocReader\\": "src/PhpDocReader" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PhpDocReader parses @var and @param values in PHP docblocks (supports namespaced class names with the same resolution rules as PHP)", + "keywords": [ + "phpdoc", + "reflection" + ], + "support": { + "issues": "https://github.com/PHP-DI/PhpDocReader/issues", + "source": "https://github.com/PHP-DI/PhpDocReader/tree/2.2.1" + }, + "time": "2020-10-12T12:39:22+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.9.3", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2024-07-20T21:41:07+00:00" + }, + { + "name": "psr/container", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], "authors": [ { - "name": "Nikita Popov", - "email": "nikic@php.net" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "Fast request router for PHP", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ - "router", - "routing" + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" ], "support": { - "issues": "https://github.com/nikic/FastRoute/issues", - "source": "https://github.com/nikic/FastRoute/tree/master" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2018-02-13T20:26:39+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { - "name": "phpoption/phpoption", - "version": "1.9.3", + "name": "psr/http-message", + "version": "1.1", "source": { "type": "git", - "url": "https://github.com/schmittjoh/php-option.git", - "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" + "url": "https://github.com/php-fig/http-message.git", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", - "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "shasum": "" }, "require": { - "php": "^7.2.5 || ^8.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - }, "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { "psr-4": { - "PhpOption\\": "src/PhpOption/" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache-2.0" + "MIT" ], "authors": [ { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh" - }, - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Option Type for PHP", + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", "keywords": [ - "language", - "option", - "php", - "type" + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" ], "support": { - "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" + "source": "https://github.com/php-fig/http-message/tree/1.1" }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", - "type": "tidelift" - } - ], - "time": "2024-07-20T21:41:07+00:00" + "time": "2023-04-04T09:50:52+00:00" }, { - "name": "pimple/pimple", - "version": "v3.5.0", + "name": "psr/http-server-handler", + "version": "1.0.2", "source": { "type": "git", - "url": "https://github.com/silexphp/Pimple.git", - "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed" + "url": "https://github.com/php-fig/http-server-handler.git", + "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a94b3a4db7fb774b3d78dad2315ddc07629e1bed", - "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed", + "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/84c4fb66179be4caaf8e97bd239203245302e7d4", + "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1 || ^2.0" - }, - "require-dev": { - "symfony/phpunit-bridge": "^5.4@dev" + "php": ">=7.0", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "Pimple": "src/" + "psr-4": { + "Psr\\Http\\Server\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -855,42 +1512,55 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "Pimple, a simple Dependency Injection Container", - "homepage": "https://pimple.symfony.com", + "description": "Common interface for HTTP server-side request handler", "keywords": [ - "container", - "dependency injection" + "handler", + "http", + "http-interop", + "psr", + "psr-15", + "psr-7", + "request", + "response", + "server" ], "support": { - "source": "https://github.com/silexphp/Pimple/tree/v3.5.0" + "source": "https://github.com/php-fig/http-server-handler/tree/1.0.2" }, - "time": "2021-10-28T11:13:42+00:00" + "time": "2023-04-10T20:06:20+00:00" }, { - "name": "psr/container", - "version": "1.1.2", + "name": "psr/http-server-middleware", + "version": "1.0.2", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "url": "https://github.com/php-fig/http-server-middleware.git", + "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/c1481f747daaa6a0782775cd6a8c26a1bf4a3829", + "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829", "shasum": "" }, "require": { - "php": ">=7.4.0" + "php": ">=7.0", + "psr/http-message": "^1.0 || ^2.0", + "psr/http-server-handler": "^1.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-4": { - "Psr\\Container\\": "src/" + "Psr\\Http\\Server\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -903,47 +1573,49 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Common interface for HTTP server-side middleware", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "http", + "http-interop", + "middleware", + "psr", + "psr-15", + "psr-7", + "request", + "response" ], "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "issues": "https://github.com/php-fig/http-server-middleware/issues", + "source": "https://github.com/php-fig/http-server-middleware/tree/1.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2023-04-11T06:14:47+00:00" }, { - "name": "psr/event-dispatcher", - "version": "1.0.0", + "name": "psr/log", + "version": "1.1.4", "source": { "type": "git", - "url": "https://github.com/php-fig/event-dispatcher.git", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { "psr-4": { - "Psr\\EventDispatcher\\": "src/" + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -953,48 +1625,47 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], - "description": "Standard interfaces for event handling.", + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "events", + "log", "psr", - "psr-14" + "psr-3" ], "support": { - "issues": "https://github.com/php-fig/event-dispatcher/issues", - "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + "source": "https://github.com/php-fig/log/tree/1.1.4" }, - "time": "2019-01-08T18:20:26+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { - "name": "psr/http-message", - "version": "1.1", + "name": "ralouphie/getallheaders", + "version": "3.0.3", "source": { "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": ">=5.6" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" }, + "type": "library", "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } + "files": [ + "src/getallheaders.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1002,45 +1673,40 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" } ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], + "description": "A polyfill for getallheaders.", "support": { - "source": "https://github.com/php-fig/http-message/tree/1.1" + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" }, - "time": "2023-04-04T09:50:52+00:00" + "time": "2019-03-08T08:55:37+00:00" }, { "name": "slim/php-view", - "version": "2.2.1", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/slimphp/PHP-View.git", - "reference": "a13ada9d7962ca1b48799c0d9ffbca4c33245aed" + "reference": "ef1821663a6a028b9e446e8c6818fd257bf70313" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/PHP-View/zipball/a13ada9d7962ca1b48799c0d9ffbca4c33245aed", - "reference": "a13ada9d7962ca1b48799c0d9ffbca4c33245aed", + "url": "https://api.github.com/repos/slimphp/PHP-View/zipball/ef1821663a6a028b9e446e8c6818fd257bf70313", + "reference": "ef1821663a6a028b9e446e8c6818fd257bf70313", "shasum": "" }, "require": { - "psr/http-message": "^1.0" + "php": "^7.4 || ^8.0", + "psr/http-message": "^1.1 || ^2.0" }, "require-dev": { - "phpunit/phpunit": "^4.8", - "slim/slim": "^3.0" + "phpstan/phpstan": "^1", + "phpunit/phpunit": "^9 || ^10", + "slim/psr7": "^1.6", + "squizlabs/php_codesniffer": "^3.10" }, "type": "library", "autoload": { @@ -1070,40 +1736,140 @@ ], "support": { "issues": "https://github.com/slimphp/PHP-View/issues", - "source": "https://github.com/slimphp/PHP-View/tree/2.2.1" + "source": "https://github.com/slimphp/PHP-View/tree/3.4.0" }, - "time": "2019-04-15T20:43:28+00:00" + "time": "2024-07-19T18:54:54+00:00" }, { - "name": "slim/slim", - "version": "3.12.5", + "name": "slim/psr7", + "version": "1.6.1", "source": { "type": "git", - "url": "https://github.com/slimphp/Slim.git", - "reference": "565632b2d9b64ecedf89546edbbf4f3648089f0c" + "url": "https://github.com/slimphp/Slim-Psr7.git", + "reference": "72d2b2bac94ab4575d369f605dbfafbe168d3163" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/565632b2d9b64ecedf89546edbbf4f3648089f0c", - "reference": "565632b2d9b64ecedf89546edbbf4f3648089f0c", + "url": "https://api.github.com/repos/slimphp/Slim-Psr7/zipball/72d2b2bac94ab4575d369f605dbfafbe168d3163", + "reference": "72d2b2bac94ab4575d369f605dbfafbe168d3163", "shasum": "" }, "require": { - "ext-json": "*", - "ext-libxml": "*", - "ext-simplexml": "*", - "nikic/fast-route": "^1.0", - "php": ">=5.5.0", - "pimple/pimple": "^3.0", - "psr/container": "^1.0", - "psr/http-message": "^1.0" + "fig/http-message-util": "^1.1.5", + "php": "^7.4 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0", + "symfony/polyfill-php80": "^1.26" }, "provide": { + "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { - "phpunit/phpunit": "^4.0", - "squizlabs/php_codesniffer": "^3.6.0" + "adriansuter/php-autoload-override": "^1.3", + "ext-json": "*", + "http-interop/http-factory-tests": "^0.9.0", + "php-http/psr7-integration-tests": "1.1", + "phpspec/prophecy": "^1.15", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/phpstan": "^1.8", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\Psr7\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "http://joshlockhart.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" + } + ], + "description": "Strict PSR-7 implementation", + "homepage": "https://www.slimframework.com", + "keywords": [ + "http", + "psr-7", + "psr7" + ], + "support": { + "issues": "https://github.com/slimphp/Slim-Psr7/issues", + "source": "https://github.com/slimphp/Slim-Psr7/tree/1.6.1" + }, + "time": "2023-04-17T16:02:20+00:00" + }, + { + "name": "slim/slim", + "version": "4.14.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim.git", + "reference": "5943393b88716eb9e82c4161caa956af63423913" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/5943393b88716eb9e82c4161caa956af63423913", + "reference": "5943393b88716eb9e82c4161caa956af63423913", + "shasum": "" + }, + "require": { + "ext-json": "*", + "nikic/fast-route": "^1.3", + "php": "^7.4 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "psr/http-factory": "^1.1", + "psr/http-message": "^1.1 || ^2.0", + "psr/http-server-handler": "^1.0", + "psr/http-server-middleware": "^1.0", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "require-dev": { + "adriansuter/php-autoload-override": "^1.4", + "ext-simplexml": "*", + "guzzlehttp/psr7": "^2.6", + "httpsoft/http-message": "^1.1", + "httpsoft/http-server-request": "^1.1", + "laminas/laminas-diactoros": "^2.17 || ^3", + "nyholm/psr7": "^1.8", + "nyholm/psr7-server": "^1.1", + "phpspec/prophecy": "^1.19", + "phpspec/prophecy-phpunit": "^2.1", + "phpstan/phpstan": "^1.11", + "phpunit/phpunit": "^9.6", + "slim/http": "^1.3", + "slim/psr7": "^1.6", + "squizlabs/php_codesniffer": "^3.10", + "vimeo/psalm": "^5.24" + }, + "suggest": { + "ext-simplexml": "Needed to support XML format in BodyParsingMiddleware", + "ext-xml": "Needed to support XML format in BodyParsingMiddleware", + "php-di/php-di": "PHP-DI is the recommended container library to be used with Slim", + "slim/psr7": "Slim PSR-7 implementation. See https://www.slimframework.com/docs/v4/start/installation.html for more information." }, "type": "library", "autoload": { @@ -1131,6 +1897,11 @@ "email": "rob@akrabat.com", "homepage": "http://akrabat.com" }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" + }, { "name": "Gabriel Manricks", "email": "gmanricks@me.com", @@ -1138,7 +1909,7 @@ } ], "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", - "homepage": "https://slimframework.com", + "homepage": "https://www.slimframework.com", "keywords": [ "api", "framework", @@ -1146,8 +1917,14 @@ "router" ], "support": { + "docs": "https://www.slimframework.com/docs/v4/", + "forum": "https://discourse.slimframework.com/", + "irc": "irc://irc.freenode.net:6667/slimphp", "issues": "https://github.com/slimphp/Slim/issues", - "source": "https://github.com/slimphp/Slim/tree/3.12.5" + "rss": "https://www.slimframework.com/blog/feed.rss", + "slack": "https://slimphp.slack.com/", + "source": "https://github.com/slimphp/Slim", + "wiki": "https://github.com/slimphp/Slim/wiki" }, "funding": [ { @@ -1159,30 +1936,35 @@ "type": "tidelift" } ], - "time": "2023-07-23T04:32:51+00:00" + "time": "2024-06-13T08:54:48+00:00" }, { "name": "slim/twig-view", - "version": "2.5.1", + "version": "3.4.1", "source": { "type": "git", "url": "https://github.com/slimphp/Twig-View.git", - "reference": "47bd5cc1cbbdf5196d0873ece0ee97c6c7b352e9" + "reference": "b4268d87d0e327feba5f88d32031e9123655b909" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Twig-View/zipball/47bd5cc1cbbdf5196d0873ece0ee97c6c7b352e9", - "reference": "47bd5cc1cbbdf5196d0873ece0ee97c6c7b352e9", + "url": "https://api.github.com/repos/slimphp/Twig-View/zipball/b4268d87d0e327feba5f88d32031e9123655b909", + "reference": "b4268d87d0e327feba5f88d32031e9123655b909", "shasum": "" }, "require": { - "php": ">=5.5.0", - "psr/http-message": "^1.0", - "twig/twig": "^1.38|^2.7|^3.0" + "php": "^7.4 || ^8.0", + "psr/http-message": "^1.1 || ^2.0", + "slim/slim": "^4.12", + "symfony/polyfill-php81": "^1.29", + "twig/twig": "^3.11" }, "require-dev": { - "phpunit/phpunit": "^4.8|^5.7", - "slim/slim": "^3.10" + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/phpstan": "^1.10.59", + "phpunit/phpunit": "^9.6 || ^10", + "psr/http-factory": "^1.0", + "squizlabs/php_codesniffer": "^3.9" }, "type": "library", "autoload": { @@ -1199,10 +1981,15 @@ "name": "Josh Lockhart", "email": "hello@joshlockhart.com", "homepage": "http://joshlockhart.com" + }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" } ], - "description": "Slim Framework 3 view helper built on top of the Twig 2 templating component", - "homepage": "http://slimframework.com", + "description": "Slim Framework 4 view helper built on top of the Twig 3 templating component", + "homepage": "https://www.slimframework.com", "keywords": [ "framework", "slim", @@ -1212,9 +1999,9 @@ ], "support": { "issues": "https://github.com/slimphp/Twig-View/issues", - "source": "https://github.com/slimphp/Twig-View/tree/master" + "source": "https://github.com/slimphp/Twig-View/tree/3.4.1" }, - "time": "2019-11-28T18:03:50+00:00" + "time": "2024-09-26T05:42:02+00:00" }, { "name": "spatie/yaml-front-matter", @@ -2382,36 +3169,43 @@ }, { "name": "vlucas/phpdotenv", - "version": "v3.6.10", + "version": "v5.6.2", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e" + "reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/5b547cdb25825f10251370f57ba5d9d924e6f68e", - "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/24ac4c74f91ee2c193fa1aaa5c249cb0822809af", + "reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0 || ^8.0", - "phpoption/phpoption": "^1.5.2", - "symfony/polyfill-ctype": "^1.17" + "ext-pcre": "*", + "graham-campbell/result-type": "^1.1.3", + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.3", + "symfony/polyfill-ctype": "^1.24", + "symfony/polyfill-mbstring": "^1.24", + "symfony/polyfill-php80": "^1.24" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", "ext-filter": "*", - "ext-pcre": "*", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21" + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" }, "suggest": { - "ext-filter": "Required to use the boolean validator.", - "ext-pcre": "Required to use most of the library." + "ext-filter": "Required to use the boolean validator." }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, "branch-alias": { - "dev-master": "3.6-dev" + "dev-master": "5.6-dev" } }, "autoload": { @@ -2443,7 +3237,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v3.6.10" + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.2" }, "funding": [ { @@ -2455,7 +3249,7 @@ "type": "tidelift" } ], - "time": "2021-12-12T23:02:06+00:00" + "time": "2025-04-30T23:37:27+00:00" }, { "name": "voku/stop-words", diff --git a/public/index.php b/public/index.php index 342030d..fc205dd 100644 --- a/public/index.php +++ b/public/index.php @@ -1,4 +1,8 @@ writeln('Emptying caches...'); diff --git a/src/CLI/Commands/ScrapeImages.php b/src/CLI/Commands/ScrapeImages.php index aeff9d0..a4654a7 100644 --- a/src/CLI/Commands/ScrapeImages.php +++ b/src/CLI/Commands/ScrapeImages.php @@ -119,10 +119,6 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($changed) { file_put_contents($itemFile, $contents); } - - - - } return 0; diff --git a/src/Containers/DB.php b/src/Containers/DB.php index 2ee9827..30fd4a6 100644 --- a/src/Containers/DB.php +++ b/src/Containers/DB.php @@ -8,13 +8,13 @@ class DB { public static function load(ContainerInterface $container) { - $container['db'] = function (ContainerInterface $container) { - $dir = getenv('BASE_DIRECTORY') . 'db/db.sqlite'; + $container->set('db', function (ContainerInterface $container) { + $dir = $_ENV['BASE_DIRECTORY'] . 'db/db.sqlite'; $db = new \PDO('sqlite:' . $dir); $db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $db->setAttribute(\PDO::ATTR_TIMEOUT, 10000); $db->exec('PRAGMA busy_timeout = 15000'); return $db; - }; + }); } } diff --git a/src/Containers/ErrorHandlers.php b/src/Containers/ErrorHandlers.php index f7cbb45..91d8cfa 100644 --- a/src/Containers/ErrorHandlers.php +++ b/src/Containers/ErrorHandlers.php @@ -3,27 +3,45 @@ namespace MODXDocs\Containers; use MODXDocs\Views\Error; -use Slim\Container; - +use Psr\Container\ContainerInterface; +use Slim\App; +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\ServerRequestInterface; +use Slim\Exception\HttpNotFoundException; use MODXDocs\Views\NotFound; +use Throwable; +use Slim\Psr7\Response; class ErrorHandlers { - public static function load(Container $container) + public static function load(ContainerInterface $container) { - $container['notFoundHandler'] = function ($container) { - return function ($request, $response) use ($container) { + $app = $container->get(App::class); + + // Add Error Middleware + $errorMiddleware = $app->addErrorMiddleware( + $_ENV['DEV'] === '1', // displayErrorDetails + true, // logErrors + true, // logErrorDetails + $container->get('logger') + ); + + // Set the Not Found Handler + $errorMiddleware->setErrorHandler( + HttpNotFoundException::class, + function (ServerRequestInterface $request, Throwable $exception, bool $displayErrorDetails) use ($container): ResponseInterface { $pageNotFound = new NotFound($container); + return $pageNotFound->get($request, new Response()); + } + ); - return $pageNotFound->get($request, $response); - }; - }; - $container['errorHandler'] = $container['phpErrorHandler'] = function ($container) { - return function ($request, $response, $exception) use ($container) { + // Set the Error Handler + $errorMiddleware->setErrorHandler( + Throwable::class, + function (ServerRequestInterface $request, Throwable $exception, bool $displayErrorDetails) use ($container): ResponseInterface { $pageNotFound = new Error($container, $exception); - - return $pageNotFound->get($request, $response); - }; - }; + return $pageNotFound->get($request, new Response()); + } + ); } } diff --git a/src/Containers/Logger.php b/src/Containers/Logger.php index 3ae452b..a4c2dcf 100644 --- a/src/Containers/Logger.php +++ b/src/Containers/Logger.php @@ -5,23 +5,19 @@ use Monolog\Logger as MonologLogger; use Monolog\Processor\UidProcessor; use Monolog\Handler\StreamHandler; -use Slim\Container; +use Psr\Container\ContainerInterface; class Logger { - public static function load(Container $container) + public static function load(ContainerInterface $container) { - $container['logger'] = function () { - - $logger = new MonologLogger('modx-docs'); - - $logger->pushProcessor(new UidProcessor()); - $logger->pushHandler(new StreamHandler( - isset($_ENV['docker']) ? 'php://stdout' : getenv('BASE_DIRECTORY') . '/logs/app.log', - MonologLogger::DEBUG + $container->set('logger', function (ContainerInterface $container) { + $logger = new \Monolog\Logger('app'); + $logger->pushHandler(new \Monolog\Handler\StreamHandler( + isset($_ENV['docker']) ? 'php://stdout' : $_ENV['BASE_DIRECTORY'] . '/logs/app.log', + \Monolog\Logger::DEBUG )); - return $logger; - }; + }); } } \ No newline at end of file diff --git a/src/Containers/Services.php b/src/Containers/Services.php index e51bec5..44f797a 100644 --- a/src/Containers/Services.php +++ b/src/Containers/Services.php @@ -5,7 +5,7 @@ use MODXDocs\Services\IndexService; use MODXDocs\Services\SearchService; use MODXDocs\Services\TranslationService; -use Slim\Container; +use Psr\Container\ContainerInterface; use MODXDocs\Services\FilePathService; use MODXDocs\Services\DocumentService; @@ -13,43 +13,44 @@ class Services { - public static function load(Container $container): void + public static function load(ContainerInterface $container): void { - $container[FilePathService::class] = function () { + $container->set(FilePathService::class, function () { return new FilePathService(); - }; + }); - $container[DocumentService::class] = function (Container $container) { + $container->set(DocumentService::class, function (ContainerInterface $container) { return new DocumentService( $container->get(FilePathService::class), $container->get('db') ); - }; + }); - $container[VersionsService::class] = function (Container $container) { + $container->set(VersionsService::class, function (ContainerInterface $container) { return new VersionsService( $container->get('router') ); - }; + }); - $container[TranslationService::class] = function (Container $container) { + $container->set(TranslationService::class, function (ContainerInterface $container) { return new TranslationService( $container->get('db'), $container->get('router') ); - }; + }); - $container[SearchService::class] = function (Container $container) { + $container->set(SearchService::class, function (ContainerInterface $container) { return new SearchService( $container->get('db'), $container->get(DocumentService::class) ); - }; - $container[IndexService::class] = function (Container $container) { + }); + + $container->set(IndexService::class, function (ContainerInterface $container) { return new IndexService( $container->get('db'), $container->get(DocumentService::class) ); - }; + }); } } diff --git a/src/Containers/View.php b/src/Containers/View.php index 569f678..193a66b 100644 --- a/src/Containers/View.php +++ b/src/Containers/View.php @@ -3,8 +3,9 @@ namespace MODXDocs\Containers; use Psr\Container\ContainerInterface; +use Psr\Http\Message\ServerRequestInterface; +use Slim\Interfaces\RouteParserInterface; use Slim\Views\Twig; -use Slim\Views\TwigExtension; use Twig\Extension\DebugExtension; use MODXDocs\Twig\DocExtensions; @@ -15,23 +16,28 @@ class View public static function load(ContainerInterface $container) { - $container['view'] = function (ContainerInterface $container) { - $request = $container->get('request'); - $router = $container->get('router'); - - $view = new Twig(getenv('TEMPLATE_DIRECTORY'), [ - 'cache' => getenv('DEV') === '1' ? false : getenv('CACHE_DIRECTORY') . '/twig', + $container->set('view', function (ContainerInterface $container) { + $request = $container->get(ServerRequestInterface::class); + $router = $container->get(RouteParserInterface::class); + + $templateDir = $_ENV['TEMPLATE_DIRECTORY'] ?? null; + if ($templateDir === null) { + throw new \RuntimeException('TEMPLATE_DIRECTORY environment variable is not set'); + } + // Remove quotes if present + $templateDir = trim($templateDir, '"\''); + + $view = Twig::create($templateDir, [ + 'cache' => $_ENV['DEV'] === '1' ? false : $_ENV['CACHE_DIRECTORY'] . '/twig', 'debug' => true, ]); $view->addExtension(new DebugExtension()); - - // Instantiate and add Slim specific extension - $basePath = rtrim(str_ireplace(static::BASE_REQUEST_HANDLER, '', $request->getUri()->getBasePath()), '/'); - $view->addExtension(new TwigExtension($router, $basePath)); + // Add Slim specific extension + $basePath = rtrim(str_ireplace(static::BASE_REQUEST_HANDLER, '', $request->getUri()->getPath()), '/'); $view->addExtension(new DocExtensions($router, $request)); return $view; - }; + }); } } diff --git a/src/DocsApp.php b/src/DocsApp.php index b307491..f9d6da8 100644 --- a/src/DocsApp.php +++ b/src/DocsApp.php @@ -2,67 +2,126 @@ namespace MODXDocs; -use MODXDocs\Containers\DB; -use MODXDocs\Views\Search; -use MODXDocs\Views\Stats\NotFoundRequests; -use MODXDocs\Views\Stats\Searches; +use DI\Container; +use DI\ContainerBuilder; +use Psr\Http\Message\ResponseFactoryInterface; +use Psr\Http\Message\ServerRequestInterface; use Slim\App; -use Slim\Http\Request; -use Slim\Http\Response; - -use MODXDocs\Containers\View; +use Slim\Factory\AppFactory; +use Slim\Interfaces\RouteParserInterface; +use Slim\Psr7\Factory\ResponseFactory; +use Slim\Psr7\Factory\ServerRequestFactory; +use Slim\Routing\RouteCollector; +use Slim\Views\TwigMiddleware; use MODXDocs\Containers\ErrorHandlers; use MODXDocs\Containers\Logger; use MODXDocs\Containers\Services; +use MODXDocs\Containers\View; +use MODXDocs\Containers\DB; use MODXDocs\Middlewares\RequestMiddleware; -use MODXDocs\Views\Doc; class DocsApp { /** @var App */ private $app; + /** @var Container */ + private $container; + public function __construct(array $settings) { - $this->app = new App($settings); + // Create Container using ContainerBuilder + $containerBuilder = new ContainerBuilder(); - $this->routes(); - $this->dependencies(); - $this->middlewares(); - } + // Define container entries + $containerBuilder->addDefinitions([ + 'settings' => $settings, + ResponseFactoryInterface::class => function () { + return new ResponseFactory(); + }, + ServerRequestInterface::class => function () { + return (new ServerRequestFactory())->createFromGlobals(); + }, + 'request' => function (Container $c) { + return $c->get(ServerRequestInterface::class); + }, + 'response' => function (Container $c) { + return $c->get(ResponseFactoryInterface::class)->createResponse(); + }, + RouteCollector::class => function (Container $c) { + return $c->get(App::class)->getRouteCollector(); + }, + RouteParserInterface::class => function (Container $c) { + return $c->get(RouteCollector::class)->getRouteParser(); + }, + 'router' => function (Container $c) { + return $c->get(RouteParserInterface::class); + } + ]); - private function routes() - { - $this->app->get('/', Doc::class . ':get')->setName('home'); - $this->app->get('/stats/searches', Searches::class . ':get')->setName('stats/searches'); - $this->app->get('/stats/page-not-found', NotFoundRequests::class . ':get')->setName('stats/page-not-found'); - $this->app->get('/{version}/{language}/search', Search::class . ':get')->setName('search'); - $this->app->get('/{version}/{language}/{path:.*}', Doc::class . ':get')->setName('documentation'); - } + $this->container = $containerBuilder->build(); - private function middlewares() - { + // Create App with Container + AppFactory::setContainer($this->container); + $this->app = AppFactory::create(); + + // Store app in container + $this->container->set(App::class, $this->app); + + // Register services + Services::load($this->container); + Logger::load($this->container); + View::load($this->container); + DB::load($this->container); + + // Add middleware $this->app->add(new RequestMiddleware()); - } + $this->app->add(TwigMiddleware::createFromContainer($this->app)); - private function dependencies() - { - $containers = [ - DB::class, - View::class, - ErrorHandlers::class, - Logger::class, - Services::class - ]; - - foreach ($containers as $container) { - call_user_func([$container, 'load'], $this->app->getContainer()); - } + // Add error handling + ErrorHandlers::load($this->container); + + // Add routes + $this->addRoutes(); } - public function getContainer() + private function addRoutes() { - return $this->app->getContainer(); + $app = $this->app; + $container = $this->container; + + $app->get('/', function ($request, $response) { + return $response->withHeader('Location', '/current/en/')->withStatus(301); + }); + + $app->get('/stats/searches', function ($request, $response) use ($container) { + $page = new \MODXDocs\Views\Stats\Searches($container); + return $page->get($request, $response); + })->setName('stats/searches'); + + $app->get('/stats/page-not-found', function ($request, $response) use ($container) { + $page = new \MODXDocs\Views\Stats\NotFoundRequests($container); + return $page->get($request, $response); + })->setName('stats/page-not-found'); + + $app->get('/{version}/{language}/search', function ($request, $response, $args) use ($container) { + $page = new \MODXDocs\Views\Search($container); + return $page->get($request, $response); + })->setName('search'); + + $app->get('/{version}/{language}/{path:.*}', function ($request, $response, $args) use ($container) { + $pageRequest = \MODXDocs\Model\PageRequest::fromRequest($request); + $documentService = $container->get(\MODXDocs\Services\DocumentService::class); + try { + $document = $documentService->load($pageRequest); + } catch (\MODXDocs\Exceptions\NotFoundException $e) { + $pageNotFound = new \MODXDocs\Views\NotFound($container); + return $pageNotFound->get($request, $response); + } + + $page = new \MODXDocs\Views\Doc($container); + return $page->get($request, $response, $document); + })->setName('documentation'); } public function run() @@ -70,9 +129,8 @@ public function run() $this->app->run(); } - public function process(Request $request, Response $response) + public function getContainer() { - return $this->app->process($request, $response); + return $this->container; } - } diff --git a/src/Helpers/LinkRenderer.php b/src/Helpers/LinkRenderer.php index 1b9fce5..304e330 100644 --- a/src/Helpers/LinkRenderer.php +++ b/src/Helpers/LinkRenderer.php @@ -58,7 +58,7 @@ public function render(Node $node, ChildNodeRendererInterface $childRenderer) $attributes['rel'] = 'noreferrer noopener'; } else { // Check if the link points to somewhere valid - $docs = getenv('DOCS_DIRECTORY'); + $docs = $_ENV['DOCS_DIRECTORY']; $href = static::replaceCurrentUrl($href); if (!file_exists($docs . $href . '.md') && !file_exists($docs . $href . '/index.md')) { try { diff --git a/src/Helpers/Redirector.php b/src/Helpers/Redirector.php index 5262c71..3651deb 100644 --- a/src/Helpers/Redirector.php +++ b/src/Helpers/Redirector.php @@ -16,7 +16,7 @@ public static function findNewURI($uri) $redirects = []; // Start by collecting the available redirects per version - $dir = new \DirectoryIterator(getenv('DOCS_DIRECTORY')); + $dir = new \DirectoryIterator($_ENV['DOCS_DIRECTORY']); foreach ($dir as $fileinfo) { if (!$fileinfo->isDir() || $fileinfo->isDot()) { continue; diff --git a/src/Helpers/SettingsParser.php b/src/Helpers/SettingsParser.php index b9b325a..2b90a03 100644 --- a/src/Helpers/SettingsParser.php +++ b/src/Helpers/SettingsParser.php @@ -13,7 +13,7 @@ public function __construct() { $baseDir = dirname(dirname(__DIR__)) . '/'; $dotFile = static::getDotFile($baseDir); - $dotEnv = Dotenv::create($baseDir, $dotFile); + $dotEnv = Dotenv::createImmutable($baseDir, $dotFile); $dotEnv->load(); } @@ -21,7 +21,7 @@ public function getSlimConfig() { return [ 'settings' => [ - 'displayErrorDetails' => getenv('DEV') === '1', + 'displayErrorDetails' => $_ENV['DEV'] === '1', 'addContentLengthHeader' => false, ] ]; diff --git a/src/Middlewares/RequestMiddleware.php b/src/Middlewares/RequestMiddleware.php index 0b8a41f..e9bd2c2 100644 --- a/src/Middlewares/RequestMiddleware.php +++ b/src/Middlewares/RequestMiddleware.php @@ -2,12 +2,14 @@ namespace MODXDocs\Middlewares; -use Slim\Http\Response; -use Slim\Http\Request; +use Psr\Http\Message\ResponseInterface as Response; +use Psr\Http\Message\ServerRequestInterface as Request; +use Psr\Http\Server\MiddlewareInterface; +use Psr\Http\Server\RequestHandlerInterface as RequestHandler; -class RequestMiddleware +class RequestMiddleware implements MiddlewareInterface { - public function __invoke(Request $request, Response $response, $next) + public function process(Request $request, RequestHandler $handler): Response { $uri = $request->getUri(); $path = $uri->getPath(); @@ -18,12 +20,13 @@ public function __invoke(Request $request, Response $response, $next) $uri = $uri->withPath(substr($path, 0, -1)); if ($request->getMethod() === 'GET') { - return $response->withRedirect((string)$uri, 301); + $response = new \Slim\Psr7\Response(); + return $response->withHeader('Location', (string)$uri)->withStatus(301); } - return $next($request->withUri($uri), $response); + return $handler->handle($request->withUri($uri)); } - return $next($request, $response); + return $handler->handle($request); } } \ No newline at end of file diff --git a/src/Model/Page.php b/src/Model/Page.php index cc1b8ee..dc31f45 100644 --- a/src/Model/Page.php +++ b/src/Model/Page.php @@ -77,7 +77,7 @@ public function __construct(DocumentService $documentService, PDO $db, string $v $this->documentService = $documentService; $this->db = $db; - $docRoot = getenv('DOCS_DIRECTORY'); + $docRoot = $_ENV['DOCS_DIRECTORY']; if (strpos($filePath, $docRoot) === 0) { $filePath = ltrim(substr($filePath, strlen($docRoot)), '/'); } @@ -150,7 +150,7 @@ public function getUrl(): string public function getCanonicalUrl(): string { $version = $this->version === VersionsService::getCurrentVersionBranch() ? VersionsService::getCurrentVersion() : $this->version; - return getenv('CANONICAL_BASE_URL') . $version . '/' . $this->language . '/' . $this->path; + return $_ENV['CANONICAL_BASE_URL'] . $version . '/' . $this->language . '/' . $this->path; } /** @@ -306,7 +306,7 @@ public function getFileCommits() '--', substr($this->relativeFilePath, strpos($this->relativeFilePath, '/') + 1) ]); - $cmd->setWorkingDirectory(getenv('DOCS_DIRECTORY') . substr($this->relativeFilePath, 0, strpos($this->relativeFilePath, '/'))); + $cmd->setWorkingDirectory($_ENV['DOCS_DIRECTORY'] . substr($this->relativeFilePath, 0, strpos($this->relativeFilePath, '/'))); if ($cmd->run() !== 0) { return []; @@ -382,4 +382,18 @@ private function _getAvatarFor($email): string return $gravatarUrl; } + + public function getContent() + { + $docRoot = $_ENV['DOCS_DIRECTORY']; + $file = $docRoot . $this->relativeFilePath; + return file_get_contents($file); + } + + public function updateFromGit() + { + $cmd = new \Symfony\Component\Process\Process(['git', 'pull']); + $cmd->setWorkingDirectory($_ENV['DOCS_DIRECTORY'] . substr($this->relativeFilePath, 0, strpos($this->relativeFilePath, '/'))); + $cmd->run(); + } } diff --git a/src/Model/PageRequest.php b/src/Model/PageRequest.php index 629d99a..7014856 100644 --- a/src/Model/PageRequest.php +++ b/src/Model/PageRequest.php @@ -1,10 +1,9 @@ set($cacheKey, $items); diff --git a/src/Services/CacheService.php b/src/Services/CacheService.php index a968e92..302ffa9 100644 --- a/src/Services/CacheService.php +++ b/src/Services/CacheService.php @@ -9,8 +9,8 @@ class CacheService public function __construct() { - $this->cacheRoot = rtrim(getenv('CACHE_DIRECTORY'), '/') . '/'; - $this->enabled = (bool)getenv('CACHE_ENABLED'); + $this->cacheRoot = rtrim($_ENV['CACHE_DIRECTORY'], '/') . '/'; + $this->enabled = (bool)$_ENV['CACHE_ENABLED']; } public static function getInstance(): CacheService diff --git a/src/Services/FilePathService.php b/src/Services/FilePathService.php index 084b97f..d37de4f 100644 --- a/src/Services/FilePathService.php +++ b/src/Services/FilePathService.php @@ -32,13 +32,13 @@ public function getFilePath(PageRequest $request) : ?string return null; } - public function getAbsoluteRootPath() : string + public function getDocsRoot() { - return getenv('DOCS_DIRECTORY'); + return $_ENV['DOCS_DIRECTORY']; } public function getAbsoluteContextPath(PageRequest $request) : string { - return $this->getAbsoluteRootPath() . $request->getActualContextUrl(); + return $this->getDocsRoot() . $request->getActualContextUrl(); } } diff --git a/src/Services/TranslationService.php b/src/Services/TranslationService.php index ad58746..082f0db 100644 --- a/src/Services/TranslationService.php +++ b/src/Services/TranslationService.php @@ -2,19 +2,26 @@ namespace MODXDocs\Services; +use PDO; +use Slim\Interfaces\RouteParserInterface; use MODXDocs\Model\PageRequest; -use Slim\Router; class TranslationService { /** - * @var \PDO + * @var PDO */ private $db; - public function __construct(\PDO $db, Router $router) + /** + * @var RouteParserInterface + */ + private $router; + + public function __construct(PDO $db, RouteParserInterface $router) { $this->db = $db; + $this->router = $router; } public function getAvailableTranslations(PageRequest $request): array diff --git a/src/Services/VersionsService.php b/src/Services/VersionsService.php index c54d6ba..0d8c044 100644 --- a/src/Services/VersionsService.php +++ b/src/Services/VersionsService.php @@ -3,7 +3,7 @@ namespace MODXDocs\Services; use MODXDocs\Model\PageRequest; -use Slim\Router; +use Slim\Interfaces\RouteParserInterface; class VersionsService { @@ -13,17 +13,20 @@ class VersionsService private const DEFAULT_PATH = 'index'; private $router; + private $versionsFile; - public function __construct(Router $router) + public function __construct(RouteParserInterface $router) { $this->router = $router; + $base = $_ENV['BASE_DIRECTORY']; + $this->versionsFile = $base . 'sources.json'; } public static function getAvailableVersions($includeCurrent = true): array { $versions = []; - $base = getenv('BASE_DIRECTORY'); + $base = $_ENV['BASE_DIRECTORY']; $config = null; $files = ['sources.dist.json', 'sources.json']; foreach ($files as $file) { @@ -52,86 +55,51 @@ public static function getAvailableVersions($includeCurrent = true): array public function getVersions(PageRequest $request) { - $dir = new \DirectoryIterator(getenv('DOCS_DIRECTORY')); - - $versions = []; - - foreach ($dir as $fileInfo) { - if (!$fileInfo->isDir() || $fileInfo->isDot()) { - continue; - } - - $file = $fileInfo->getPathname() - . '/' - . $request->getLanguage() - . '/' - . $request->getPath(); - - if (file_exists($file . '.md') || file_exists($file . '/index.md')) { - $versions[] = $this->createVersion($request, $fileInfo); - } - } - - return $versions; - } - - private function createVersion(PageRequest $request, \DirectoryIterator $fileInfo) - { - $versionKey = static::getVersionUrl($fileInfo->getFilename()); - return [ - 'title' => static::getVersionTitle($fileInfo->getFilename()), - 'active' => $versionKey === $request->getVersion(), - 'key' => $versionKey, - 'uri' => $this->router->pathFor('documentation', [ - 'version' => $versionKey, - 'language' => $request->getLanguage(), - 'path' => $request->getPath(), - ]) - ]; - } - - private static function getVersionUrl($version) - { - // If we found another version e.g. 2.x, and 2.x is the `current` branch, use `current` - // instead of 2.x in the URL - if (static::getCurrentVersionBranch() === $version) { - return static::getCurrentVersion(); - } - - return $version; - } - - private static function getVersionTitle($fileVersion) - { - if (static::getCurrentVersionBranch() === $fileVersion) { - return $fileVersion . ' (current)'; + $versions = self::getAvailableVersions(); + $currentVersion = self::getCurrentVersion(); + $currentVersionBranch = self::getCurrentVersionBranch(); + + $result = []; + foreach ($versions as $versionKey => $details) { + $result[] = [ + 'key' => $versionKey, + 'name' => $details['name'] ?? $versionKey, + 'branch' => $details['branch'] ?? $versionKey, + 'url' => $this->router->urlFor('documentation', [ + 'version' => $versionKey, + 'language' => $request->getLanguage(), + 'path' => VersionsService::getDefaultPath() + ]), + 'is_current' => $versionKey === $currentVersion, + 'is_current_branch' => $versionKey === $currentVersionBranch, + ]; } - return $fileVersion; + return $result; } public static function getCurrentVersion(): string { - return static::CURRENT_VERSION; + return self::CURRENT_VERSION; } public static function getCurrentVersionBranch(): string { - return static::CURRENT_VERSION_BRANCH; + return self::CURRENT_VERSION_BRANCH; } public static function getDefaultLanguage(): string { - return static::DEFAULT_LANGUAGE; + return self::DEFAULT_LANGUAGE; } public static function getDefaultPath(): string { - return static::DEFAULT_PATH; + return self::DEFAULT_PATH; } - public static function getDocsRoot(): string + public function getDocsRoot() { - return getenv('DOCS_DIRECTORY'); + return $_ENV['DOCS_DIRECTORY']; } } diff --git a/src/Twig/DocExtensions.php b/src/Twig/DocExtensions.php index 3e88646..85c8c12 100644 --- a/src/Twig/DocExtensions.php +++ b/src/Twig/DocExtensions.php @@ -5,15 +5,15 @@ use MODXDocs\Views\Base; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; -use Slim\Http\Request; -use Slim\Interfaces\RouterInterface; +use Psr\Http\Message\ServerRequestInterface as Request; +use Slim\Interfaces\RouteParserInterface; class DocExtensions extends AbstractExtension { private $router; private $request; - public function __construct(RouterInterface $router, Request $request) + public function __construct(RouteParserInterface $router, Request $request) { $this->router = $router; $this->request = $request; @@ -29,13 +29,19 @@ public function getFunctions() public function getBaseHref() { - $scheme = getenv('SSL') === '1' ? 'https' : 'http'; + $scheme = $_ENV['SSL'] === '1' ? 'https' : 'http'; $uri = $this->request->getUri(); $port = \in_array($uri->getPort(), [80, 443, null], true) ? '' : (':' . $uri->getPort()); return $scheme . '://' . $uri->getHost() . $port . '/'; } + public function getBaseUrl() + { + $scheme = $_ENV['SSL'] === '1' ? 'https' : 'http'; + return $scheme . '://' . $this->request->getUri()->getHost(); + } + public static function getInlineSvg($name, $title = '', $classes = '', $role = 'presentation', $attributes = '') { $rev = Base::getRevision(); $url = '/template/dist/sprite.svg?v=' . $rev . '#' . $name; diff --git a/src/Views/Base.php b/src/Views/Base.php index cd54c2d..6578c51 100644 --- a/src/Views/Base.php +++ b/src/Views/Base.php @@ -5,8 +5,8 @@ use MODXDocs\Model\PageRequest; use MODXDocs\Services\CacheService; use MODXDocs\Services\VersionsService; -use Slim\Http\Request; -use Slim\Http\Response; +use Psr\Http\Message\ResponseInterface as Response; +use Psr\Http\Message\ServerRequestInterface as Request; use Slim\Views\Twig; use Psr\Container\ContainerInterface; @@ -28,13 +28,13 @@ public function __construct(ContainerInterface $container) $this->versionsService = $this->container->get(VersionsService::class); } - protected function render(Request $request, Response $response, $template, array $data = []): \Psr\Http\Message\ResponseInterface + protected function render(Request $request, Response $response, $template, array $data = []): Response { $pageRequest = PageRequest::fromRequest($request); $initialData = [ 'revision' => static::getRevision(), - 'canonical_base' => getenv('CANONICAL_BASE_URL'), + 'canonical_base' => $_ENV['CANONICAL_BASE_URL'], 'current_uri' => $request->getUri()->getPath(), 'version' => $pageRequest->getVersion(), 'version_branch' => $pageRequest->getVersionBranch(), @@ -43,8 +43,8 @@ protected function render(Request $request, Response $response, $template, array 'locale' => $pageRequest->getLocale(), 'path' => $pageRequest->getPath(), 'logo_link' => $pageRequest->getContextUrl() . VersionsService::getDefaultPath(), - 'is_dev' => (bool) getenv('DEV'), - 'analytics_id' => (string) getenv('ANALYTICS_ID'), + 'is_dev' => (bool) $_ENV['DEV'], + 'analytics_id' => (string) $_ENV['ANALYTICS_ID'], 'lang' => $this->getLang($pageRequest->getLanguage()), 'opencollective' => $this->getOpenCollectiveInfo(), 'opencollective_members' => $this->getOpenCollectiveMembers(), @@ -66,7 +66,7 @@ protected function render(Request $request, Response $response, $template, array ); } - protected function render404(Request $request, Response $response, array $data = []): \Psr\Http\Message\ResponseInterface + protected function render404(Request $request, Response $response, array $data = []): Response { return $this->render( $request, @@ -80,88 +80,57 @@ protected function render404(Request $request, Response $response, array $data = public static function getRevision() : string { - if (!empty(self::$rev)) { - return self::$rev; + if (empty(static::$rev)) { + static::$rev = $_ENV['REVISION'] ?? date('YmdHis'); } - $revision = 'dev'; - - $projectDir = getenv('BASE_DIRECTORY'); - if (file_exists($projectDir . '.revision')) { - $revision = trim((string)file_get_contents($projectDir . '.revision')); - } - - self::$rev = $revision; - - return $revision; + return static::$rev; } - protected function getLang(string $language): array + protected function getLang($language) { - $lang = json_decode(file_get_contents($_ENV['BASE_DIRECTORY'] . 'lang.json'), true); - if (!is_array($lang)) { + $langFile = __DIR__ . '/../../lang.json'; + if (!file_exists($langFile)) { return []; } - if (array_key_exists($language, $lang)) { - $lang = array_merge($lang['en'], $lang[$language]); - } - else { - $lang = $lang['en']; + + $langData = json_decode(file_get_contents($langFile), true); + if (!$langData) { + return []; } - return $lang; + + return $langData[$language] ?? $langData['en'] ?? []; } - private function getOpenCollectiveInfo(): array + protected function getOpenCollectiveInfo() { $cache = CacheService::getInstance(); - $cacheKey = 'opencollective_fc'; - $info = $cache->get($cacheKey); - if (!is_array($info)) { - $data = @file_get_contents('https://opencollective.com/modx.json'); - $data = json_decode($data, true); - if (!empty($data['slug']) && $data['slug'] === 'modx') { - $data['fetched'] = time(); - $cache->set($cacheKey, $data, strtotime('+2 hours')); - $info = $data; - } + $key = 'opencollective_info'; + $info = $cache->get($key); + + if ($info === null) { + $info = json_decode(file_get_contents('https://opencollective.com/modx/members/all.json'), true); + $cache->set($key, $info, 3600); } - return $info ?: []; + return $info; } - private function getOpenCollectiveMembers(): array + protected function getOpenCollectiveMembers() { $cache = CacheService::getInstance(); - $cacheKey = 'opencollective_members_fc'; - $info = $cache->get($cacheKey); - if (!is_array($info)) { - $data = @file_get_contents('https://opencollective.com/modx/members.json?limit=50&isActive=1'); - $data = json_decode($data, true); - if (is_array($data) && count($data) > 0) { - - $merged = []; - foreach ($data as $i => $member) { - // filter out non-backers (OC itself, admin) - if ($member['role'] !== 'BACKER') { - continue; - } - - // Sometimes, users appear multiple times because of having a subscription but also - // standalone donations. Merging those profiles here makes sure they appear just once. - if (!isset($merged[$member['profile']])) { - $merged[$member['profile']] = $member; - } - } - - // Sort by total amount donated - uasort($merged, static function ($a, $b) { - return $a['totalAmountDonated'] < $b['totalAmountDonated'] ? 1 : -1; - }); - - $cache->set($cacheKey, $merged, strtotime('+2 hours')); - $info = $merged; - } + $key = 'opencollective_members'; + $members = $cache->get($key); + + if ($members === null) { + $members = json_decode(file_get_contents('https://opencollective.com/modx/members.json'), true); + $cache->set($key, $members, 3600); } - return $info ?: []; + return $members; + } + + public static function setRevision($rev = null) + { + static::$rev = $_ENV['REVISION'] ?? date('YmdHis'); } } diff --git a/src/Views/Doc.php b/src/Views/Doc.php index 858fb75..d3b5b2a 100644 --- a/src/Views/Doc.php +++ b/src/Views/Doc.php @@ -7,12 +7,12 @@ use MODXDocs\Model\PageRequest; use MODXDocs\Services\TranslationService; use Psr\Container\ContainerInterface; -use Slim\Http\Request; -use Slim\Http\Response; - +use Slim\Psr7\Request; +use Slim\Psr7\Response; use MODXDocs\Services\DocumentService; use MODXDocs\Services\VersionsService; -use Slim\Http\Stream; +use Slim\Psr7\Stream; +use Slim\Exception\HttpNotFoundException; class Doc extends Base { @@ -20,7 +20,6 @@ class Doc extends Base private $translationService; /** @var DocumentService */ private $documentService; - /** @var VersionsService */ public function __construct(ContainerInterface $container) { @@ -33,7 +32,7 @@ public function __construct(ContainerInterface $container) * @param Request $request * @param Response $response * @return \Psr\Http\Message\ResponseInterface - * @throws \Slim\Exception\NotFoundException + * @throws HttpNotFoundException */ public function get(Request $request, Response $response) { @@ -47,7 +46,7 @@ public function get(Request $request, Response $response) if (file_exists($filePath)) { return $this->renderFile($request, $response, $filePath); } - throw new \Slim\Exception\NotFoundException($request, $response); + throw new HttpNotFoundException($request); } $crumbs = []; @@ -107,7 +106,7 @@ private function getTranslations(PageRequest $pageRequest) * @param Response $response * @param $filePath * @return Response - * @throws \Slim\Exception\NotFoundException + * @throws HttpNotFoundException */ protected function renderFile(Request $request, Response $response, $filePath): Response { @@ -119,7 +118,7 @@ protected function renderFile(Request $request, Response $response, $filePath): if (strpos($mime, 'image/') === 0) { $etag = 'm-' . filemtime($filePath); $provided = $request->getHeaderLine('If-None-Match'); - $age = getenv('DEV') ? 10 : 86400; + $age = $_ENV['DEV'] ? 10 : 86400; if ($etag === $provided) { return $response->withStatus(304) ->withHeader('Cache-Control', 'max-age=' . $age) @@ -132,7 +131,7 @@ protected function renderFile(Request $request, Response $response, $filePath): ->withHeader('ETag', $etag); } - throw new \Slim\Exception\NotFoundException($request, $response); + throw new HttpNotFoundException($request); } private function getSuggestedLanguages(Request $request, PageRequest $pageRequest) diff --git a/src/Views/Error.php b/src/Views/Error.php index 75236d1..938c682 100644 --- a/src/Views/Error.php +++ b/src/Views/Error.php @@ -4,11 +4,8 @@ use MODXDocs\Model\PageRequest; use Psr\Container\ContainerInterface; -use Slim\Http\Request; -use Slim\Http\Response; - -use MODXDocs\Exceptions\RedirectNotFoundException; -use MODXDocs\Helpers\Redirector; +use Slim\Psr7\Request; +use Slim\Psr7\Response; class Error extends Base { @@ -27,7 +24,7 @@ public function get(Request $request, Response $response) $data = [ 'revision' => static::getRevision(), - 'is_dev' => (bool) getenv('DEV'), + 'is_dev' => (bool) $_ENV['DEV'], 'exception_type' => get_class($this->throwable), 'exception' => $this->throwable, 'current_uri' => $request->getUri()->getPath(), diff --git a/src/Views/NotFound.php b/src/Views/NotFound.php index 6b9218b..590490b 100644 --- a/src/Views/NotFound.php +++ b/src/Views/NotFound.php @@ -9,9 +9,8 @@ use MODXDocs\Services\VersionsService; use PDO; use Psr\Container\ContainerInterface; -use Slim\Http\Request; -use Slim\Http\Response; - +use Slim\Psr7\Request; +use Slim\Psr7\Response; use MODXDocs\Exceptions\RedirectNotFoundException; use MODXDocs\Helpers\Redirector; @@ -39,13 +38,13 @@ public function get(Request $request, Response $response) // Make sure links ending in .md get redirected if (substr($currentUri, -strlen(static::MARKDOWN_SUFFIX)) === static::MARKDOWN_SUFFIX) { $uri = substr($currentUri, 0, -strlen(static::MARKDOWN_SUFFIX)); - return $response->withRedirect($uri, 301); + return $response->withHeader('Location', $uri)->withStatus(301); } try { $redirectUri = Redirector::findNewURI($currentUri); - return $response->withRedirect($redirectUri, 301); + return $response->withHeader('Location', $redirectUri)->withStatus(301); } catch (RedirectNotFoundException $e) { $this->logNotFoundRequest($currentUri); diff --git a/src/Views/Search.php b/src/Views/Search.php index 0a91fd5..de30482 100644 --- a/src/Views/Search.php +++ b/src/Views/Search.php @@ -5,17 +5,15 @@ use MODXDocs\Model\SearchQuery; use MODXDocs\Navigation\Tree; use MODXDocs\Model\PageRequest; -use MODXDocs\Services\DocumentService; use MODXDocs\Services\SearchService; -use MODXDocs\Services\VersionsService; use Psr\Container\ContainerInterface; -use Slim\Http\Request; -use Slim\Http\Response; -use Slim\Router; +use Slim\Psr7\Request; +use Slim\Psr7\Response; +use Slim\Interfaces\RouteParserInterface; class Search extends Base { - /** @var Router */ + /** @var RouteParserInterface */ private $router; /** @var SearchService */ @@ -39,22 +37,23 @@ public function get(Request $request, Response $response) // The PageRequest gives us the version/language/etc. $pageRequest = PageRequest::fromRequest($request); - $query = trim((string)$request->getParam('q', '')); + $queryParams = $request->getQueryParams(); + $query = trim((string)($queryParams['q'] ?? '')); $title = 'Search the documentation'; - $live = (bool)$request->getParam('live'); + $live = (bool)($queryParams['live'] ?? false); $crumbs = []; $crumbs[] = [ 'title' => 'Search ' . $pageRequest->getVersion(), // @todo i18n - 'href' => $this->router->pathFor('search', ['version' => $pageRequest->getVersion(), 'language' => $pageRequest->getLanguage()]) + 'href' => $this->router->urlFor('search', ['version' => $pageRequest->getVersion(), 'language' => $pageRequest->getLanguage()]) ]; $searchValues = []; if (!empty($query)) { $crumbs[] = [ 'title' => '"' . $query . '"', - 'href' => $this->router->pathFor('search', ['version' => $pageRequest->getVersion(), 'language' => $pageRequest->getLanguage()], ['q' => $query]) + 'href' => $this->router->urlFor('search', ['version' => $pageRequest->getVersion(), 'language' => $pageRequest->getLanguage()], ['q' => $query]) ]; $startTime = microtime(true); @@ -64,7 +63,7 @@ public function get(Request $request, Response $response) $resultCount = $result->getCount(); $limit = 10; - $page = abs((int)$request->getParam('page', 1)); + $page = abs((int)($queryParams['page'] ?? 1)); $totalPages = ceil($resultCount / $limit); $start = 0 + ($page - 1) * $limit; @@ -125,7 +124,7 @@ protected function getPagination(int $page, PageRequest $pageRequest, string $qu $looped++; $pagination[] = [ 'page' => $prev, - 'href' => $this->router->pathFor('search', + 'href' => $this->router->urlFor('search', ['version' => $pageRequest->getVersion(), 'language' => $pageRequest->getLanguage()], ['q' => $query, 'page' => $prev]) ]; @@ -135,7 +134,7 @@ protected function getPagination(int $page, PageRequest $pageRequest, string $qu if ($page > 1) { $pagination[] = [ 'page' => 'First', - 'href' => $this->router->pathFor('search', + 'href' => $this->router->urlFor('search', ['version' => $pageRequest->getVersion(), 'language' => $pageRequest->getLanguage()], ['q' => $query]) ]; @@ -147,7 +146,7 @@ protected function getPagination(int $page, PageRequest $pageRequest, string $qu $pagination[] = [ 'current' => true, 'page' => $page, - 'href' => $this->router->pathFor('search', + 'href' => $this->router->urlFor('search', ['version' => $pageRequest->getVersion(), 'language' => $pageRequest->getLanguage()], ['q' => $query, 'page' => $page]) ]; @@ -158,7 +157,7 @@ protected function getPagination(int $page, PageRequest $pageRequest, string $qu $looped++; $pagination[] = [ 'page' => $next, - 'href' => $this->router->pathFor('search', + 'href' => $this->router->urlFor('search', ['version' => $pageRequest->getVersion(), 'language' => $pageRequest->getLanguage()], ['q' => $query, 'page' => $next]) ]; @@ -169,7 +168,7 @@ protected function getPagination(int $page, PageRequest $pageRequest, string $qu $pagination[] = [ 'page' => 'Last', - 'href' => $this->router->pathFor('search', + 'href' => $this->router->urlFor('search', ['version' => $pageRequest->getVersion(), 'language' => $pageRequest->getLanguage()], ['q' => $query, 'page' => $totalPages]) ]; diff --git a/src/Views/Stats/NotFoundRequests.php b/src/Views/Stats/NotFoundRequests.php index 46291c4..10c4dc2 100644 --- a/src/Views/Stats/NotFoundRequests.php +++ b/src/Views/Stats/NotFoundRequests.php @@ -6,9 +6,9 @@ use MODXDocs\Services\CacheService; use MODXDocs\Views\Base; use Psr\Container\ContainerInterface; -use Slim\Http\Request; -use Slim\Http\Response; -use Slim\Router; +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\ServerRequestInterface; +use Slim\Interfaces\RouteParserInterface; class NotFoundRequests extends Base { @@ -18,7 +18,7 @@ class NotFoundRequests extends Base private $cache; /** @var DB */ private $db; - /** @var Router */ + /** @var RouteParserInterface */ private $router; public function __construct(ContainerInterface $container) @@ -30,17 +30,17 @@ public function __construct(ContainerInterface $container) } /** - * @param Request $request - * @param Response $response - * @return \Psr\Http\Message\ResponseInterface + * @param ServerRequestInterface $request + * @param ResponseInterface $response + * @return ResponseInterface * @throws \Exception */ - public function get(Request $request, Response $response) + public function get(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface { $crumbs = []; $crumbs[] = [ 'title' => 'Page Not Found Errors', // @todo i18n - 'href' => $this->router->pathFor('stats/page-not-found') + 'href' => $this->router->urlFor('stats/page-not-found') ]; $phs = [ @@ -64,7 +64,7 @@ public function get(Request $request, Response $response) return $this->render($request, $response, 'stats/not-found-requests.twig', $phs); } - private function getTopRequests() + private function getTopRequests(): array { $results = $this->cache->get('stats/notfoundrequests/top'); if (is_array($results)) { @@ -83,7 +83,7 @@ private function getTopRequests() return $results; } - private function getRecentRequests() + private function getRecentRequests(): array { $results = $this->cache->get('stats/notfoundrequests/recent'); if (is_array($results)) { diff --git a/src/Views/Stats/Searches.php b/src/Views/Stats/Searches.php index bf3ef52..34163f1 100644 --- a/src/Views/Stats/Searches.php +++ b/src/Views/Stats/Searches.php @@ -3,13 +3,12 @@ namespace MODXDocs\Views\Stats; use MODXDocs\Containers\DB; -use MODXDocs\Model\PageRequest; use MODXDocs\Services\CacheService; use MODXDocs\Views\Base; use Psr\Container\ContainerInterface; -use Slim\Http\Request; -use Slim\Http\Response; -use Slim\Router; +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\ServerRequestInterface; +use Slim\Interfaces\RouteParserInterface; class Searches extends Base { @@ -19,7 +18,7 @@ class Searches extends Base private $cache; /** @var DB */ private $db; - /** @var Router */ + /** @var RouteParserInterface */ private $router; public function __construct(ContainerInterface $container) @@ -31,17 +30,17 @@ public function __construct(ContainerInterface $container) } /** - * @param Request $request - * @param Response $response - * @return \Psr\Http\Message\ResponseInterface + * @param ServerRequestInterface $request + * @param ResponseInterface $response + * @return ResponseInterface * @throws \Exception */ - public function get(Request $request, Response $response) + public function get(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface { $crumbs = []; $crumbs[] = [ 'title' => 'Search Statistics', // @todo i18n - 'href' => $this->router->pathFor('stats/searches') + 'href' => $this->router->urlFor('stats/searches') ]; $startTime = microtime(true); @@ -68,7 +67,7 @@ public function get(Request $request, Response $response) return $this->render($request, $response, 'stats/searches.twig', $phs); } - private function getTopSearches() + private function getTopSearches(): array { $results = $this->cache->get('stats/searches/top'); if (is_array($results)) { @@ -87,7 +86,7 @@ private function getTopSearches() return $results; } - private function getSearchesWithoutResults() + private function getSearchesWithoutResults(): array { $results = $this->cache->get('stats/searches/without_results'); if (is_array($results)) { @@ -106,7 +105,7 @@ private function getSearchesWithoutResults() return $results; } - private function getRecentSearches() + private function getRecentSearches(): array { $results = $this->cache->get('stats/searches/recent'); if (is_array($results)) { diff --git a/templates/documentation.twig b/templates/documentation.twig index 136d24b..30e62d8 100644 --- a/templates/documentation.twig +++ b/templates/documentation.twig @@ -48,22 +48,22 @@ {% if 'en' in suggested_languages %} {% endif %} {% if 'nl' in suggested_languages %} {% endif %} {% if 'ru' in suggested_languages %} {% endif %} {% if 'es' in suggested_languages %} {% endif %} diff --git a/templates/layout.twig b/templates/layout.twig index c912338..8985701 100644 --- a/templates/layout.twig +++ b/templates/layout.twig @@ -79,7 +79,7 @@ {{ icon('search', 'Search', 'o-search__icon', null, 'aria-hidden="true"') }}