diff --git a/README.md b/README.md index 2d0fb52..ba39902 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ $log->addExtra('urgent', false); $log->addExtra('isExpected', true); // Sentry -$adapter = new Sentry("[YOUR_SENTRY_KEY]"), "[YOUR_SENTRY_PROJECT_ID]"); +$adapter = new Sentry("[YOUR_SENTRY_DSN]"); $logger = new Logger($adapter); $logger->addLog($log); @@ -93,11 +93,10 @@ Below is a list of supported adapters, and thier compatibly tested versions alon To run all unit tests, use the following Docker command: ```bash -docker run --rm -e TEST_RAYGUN_KEY=KKKK -e TEST_APPSIGNAL_KEY=XXXX -e TEST_SENTRY_KEY=YYYY -e TEST_SENTRY_PROJECT_ID=ZZZZ -v $(pwd):$(pwd):rw -w $(pwd) php:8.0-cli-alpine sh -c "vendor/bin/phpunit --configuration phpunit.xml tests" +docker run --rm -e TEST_RAYGUN_KEY=KKKK -e TEST_APPSIGNAL_KEY=XXXX -e TEST_SENTRY_DSN=XXXX -v $(pwd):$(pwd):rw -w $(pwd) php:8.0-cli-alpine sh -c "vendor/bin/phpunit --configuration phpunit.xml tests" ``` -> Make sure to replace `TEST_SENTRY_KEY` and `TEST_SENTRY_PROJECT_ID` environment variables value with actual keys from Sentry. If your Sentry DSN is `https://something@otherthing.ingest.sentry.io/anything`, then `TEST_SENTRY_KEY=something` and `TEST_SENTRY_PROJECT_ID=anything`. - Optionally `TEST_SENTRY_HOST` can be added to specify a self-hosted Sentry instance. +> Make sure to replace `TEST_SENTRY_DSN` with actual keys from Sentry. > Make sure to replace `TEST_APPSIGNAL_KEY` with key found in Appsignal -> Project -> App Settings -> Push & deploy -> Push Key diff --git a/composer.lock b/composer.lock index 081547e..a2aa395 100644 --- a/composer.lock +++ b/composer.lock @@ -430,18 +430,66 @@ }, "time": "2019-12-04T15:06:13+00:00" }, + { + "name": "doctrine/deprecations", + "version": "1.1.x-dev", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "eac01fbdf4e4a3635169b056608730ec0930e188" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/eac01fbdf4e4a3635169b056608730ec0930e188", + "reference": "eac01fbdf4e4a3635169b056608730ec0930e188", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.x" + }, + "time": "2023-06-07T19:57:14+00:00" + }, { "name": "doctrine/instantiator", "version": "2.0.x-dev", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d6eef505a6c46e963e54bf73bb9de43cdea70821" + "reference": "3aa0a786dd096763a5e4be2cc3bacb774859552a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d6eef505a6c46e963e54bf73bb9de43cdea70821", - "reference": "d6eef505a6c46e963e54bf73bb9de43cdea70821", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/3aa0a786dd096763a5e4be2cc3bacb774859552a", + "reference": "3aa0a786dd096763a5e4be2cc3bacb774859552a", "shasum": "" }, "require": { @@ -454,7 +502,7 @@ "phpbench/phpbench": "^1.2", "phpstan/phpstan": "^1.9.4", "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", + "phpunit/phpunit": "^10.1.0", "vimeo/psalm": "^5.4" }, "default-branch": true, @@ -499,7 +547,7 @@ "type": "tidelift" } ], - "time": "2023-01-04T15:42:40+00:00" + "time": "2023-05-30T06:43:41+00:00" }, { "name": "felixfbecker/advanced-json-rpc", @@ -675,12 +723,12 @@ "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "928a96f585b86224ebc78f8f09d0482cf15b04f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/928a96f585b86224ebc78f8f09d0482cf15b04f5", + "reference": "928a96f585b86224ebc78f8f09d0482cf15b04f5", "shasum": "" }, "require": { @@ -688,11 +736,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "default-branch": true, @@ -719,7 +768,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.x" }, "funding": [ { @@ -727,7 +776,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T17:24:01+00:00" }, { "name": "netresearch/jsonmapper", @@ -786,12 +835,12 @@ "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "19526a33fb561ef417e822e85f08a00db4059c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/19526a33fb561ef417e822e85f08a00db4059c17", + "reference": "19526a33fb561ef417e822e85f08a00db4059c17", "shasum": "" }, "require": { @@ -833,9 +882,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.16.0" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2023-06-25T14:52:30+00:00" }, { "name": "openlss/lib-array2xml", @@ -896,12 +945,12 @@ "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "36d8a21e851a9512db2b086dc5ac2c61308f0138" + "reference": "67729272c564ab9f953c81f48db44e8b1cb1e1c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/36d8a21e851a9512db2b086dc5ac2c61308f0138", - "reference": "36d8a21e851a9512db2b086dc5ac2c61308f0138", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/67729272c564ab9f953c81f48db44e8b1cb1e1c3", + "reference": "67729272c564ab9f953c81f48db44e8b1cb1e1c3", "shasum": "" }, "require": { @@ -910,7 +959,7 @@ "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" + "php": "^7.3 || ^8.0" }, "default-branch": true, "type": "library", @@ -956,7 +1005,7 @@ "type": "github" } ], - "time": "2022-02-21T19:55:33+00:00" + "time": "2023-06-01T14:19:47+00:00" }, { "name": "phar-io/version", @@ -1068,12 +1117,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "566af9fb94c556de91562fcfcbc392f66680111b" + "reference": "7b217217725dc991a0ae7b995041cee1d5019561" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/566af9fb94c556de91562fcfcbc392f66680111b", - "reference": "566af9fb94c556de91562fcfcbc392f66680111b", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/7b217217725dc991a0ae7b995041cee1d5019561", + "reference": "7b217217725dc991a0ae7b995041cee1d5019561", "shasum": "" }, "require": { @@ -1124,7 +1173,7 @@ "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" }, - "time": "2022-11-19T20:28:46+00:00" + "time": "2023-03-12T10:50:44+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -1132,15 +1181,16 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "06f36c92b434ac686de06b6563e88046943bccbe" + "reference": "07100e65d09fd50608d649fc656cae1c921a2495" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/06f36c92b434ac686de06b6563e88046943bccbe", - "reference": "06f36c92b434ac686de06b6563e88046943bccbe", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/07100e65d09fd50608d649fc656cae1c921a2495", + "reference": "07100e65d09fd50608d649fc656cae1c921a2495", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.0", "phpstan/phpdoc-parser": "^1.13" @@ -1182,26 +1232,28 @@ "issues": "https://github.com/phpDocumentor/TypeResolver/issues", "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.x" }, - "time": "2022-12-16T10:25:14+00:00" + "time": "2023-07-20T19:57:33+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.15.3", + "version": "1.23.x-dev", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "61800f71a5526081d1b5633766aa88341f1ade76" + "reference": "4a1ab8e11e9957f9cc9f89f87a7c912489f08119" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/61800f71a5526081d1b5633766aa88341f1ade76", - "reference": "61800f71a5526081d1b5633766aa88341f1ade76", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/4a1ab8e11e9957f9cc9f89f87a7c912489f08119", + "reference": "4a1ab8e11e9957f9cc9f89f87a7c912489f08119", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^4.15", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.5", @@ -1210,6 +1262,7 @@ "phpunit/phpunit": "^9.5", "symfony/process": "^5.2" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -1225,9 +1278,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.15.3" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.23.x" }, - "time": "2022-12-20T20:56:55+00:00" + "time": "2023-07-24T11:53:35+00:00" }, { "name": "phpstan/phpstan", @@ -1235,12 +1288,12 @@ "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9334ff3ded6489b78dc95161a1fbab5bed64b7c6" + "reference": "6c0217aa2b146c3e28474e8be3e87188fac55dac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9334ff3ded6489b78dc95161a1fbab5bed64b7c6", - "reference": "9334ff3ded6489b78dc95161a1fbab5bed64b7c6", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6c0217aa2b146c3e28474e8be3e87188fac55dac", + "reference": "6c0217aa2b146c3e28474e8be3e87188fac55dac", "shasum": "" }, "require": { @@ -1286,7 +1339,7 @@ "type": "tidelift" } ], - "time": "2023-01-27T20:41:39+00:00" + "time": "2023-02-18T15:01:46+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1294,19 +1347,19 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1", + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", + "nikic/php-parser": "^4.15", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1321,8 +1374,8 @@ "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -1355,7 +1408,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27" }, "funding": [ { @@ -1363,7 +1417,7 @@ "type": "github" } ], - "time": "2023-01-26T08:26:55+00:00" + "time": "2023-07-26T13:44:30+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1612,12 +1666,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "e6c588044e41e22777225c4339bce021113cc829" + "reference": "19c72d49bfdecc2dac983f3cd4b5b1aff30df7a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e6c588044e41e22777225c4339bce021113cc829", - "reference": "e6c588044e41e22777225c4339bce021113cc829", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/19c72d49bfdecc2dac983f3cd4b5b1aff30df7a1", + "reference": "19c72d49bfdecc2dac983f3cd4b5b1aff30df7a1", "shasum": "" }, "require": { @@ -1650,8 +1704,8 @@ "sebastian/version": "^3.0.2" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ "phpunit" @@ -1690,6 +1744,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6" }, "funding": [ @@ -1706,7 +1761,7 @@ "type": "tidelift" } ], - "time": "2023-01-26T08:31:58+00:00" + "time": "2023-07-18T12:32:17+00:00" }, { "name": "psr/container", @@ -2112,16 +2167,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { @@ -2166,7 +2221,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0" }, "funding": [ { @@ -2174,7 +2229,7 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment", @@ -2182,12 +2237,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "3fade0c8462024d0426a00dc1ad0a2fda0df733f" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/3fade0c8462024d0426a00dc1ad0a2fda0df733f", - "reference": "3fade0c8462024d0426a00dc1ad0a2fda0df733f", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { @@ -2237,7 +2292,7 @@ "type": "github" } ], - "time": "2022-04-14T11:24:33+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", @@ -2555,12 +2610,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e3a614438af7f71eaa6fc8e406be8a3aa5c34595" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e3a614438af7f71eaa6fc8e406be8a3aa5c34595", - "reference": "e3a614438af7f71eaa6fc8e406be8a3aa5c34595", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -2602,7 +2657,7 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -2610,7 +2665,7 @@ "type": "github" } ], - "time": "2022-07-30T08:13:09+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -2618,12 +2673,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "b7a390ae3651f7ba3675d8364bff396e87931554" + "reference": "20bdda85c7c585ab265c0c37ec052a019bae29c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/b7a390ae3651f7ba3675d8364bff396e87931554", - "reference": "b7a390ae3651f7ba3675d8364bff396e87931554", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/20bdda85c7c585ab265c0c37ec052a019bae29c4", + "reference": "20bdda85c7c585ab265c0c37ec052a019bae29c4", "shasum": "" }, "require": { @@ -2665,7 +2720,7 @@ "type": "github" } ], - "time": "2022-06-14T05:05:56+00:00" + "time": "2023-03-25T08:11:39+00:00" }, { "name": "sebastian/type", @@ -2673,12 +2728,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "4d34b23933f255b0822758a44272222cac593eb4" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/4d34b23933f255b0822758a44272222cac593eb4", - "reference": "4d34b23933f255b0822758a44272222cac593eb4", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { @@ -2721,7 +2776,7 @@ "type": "github" } ], - "time": "2022-10-01T05:56:17+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", @@ -2782,12 +2837,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740" + "reference": "b504a3d266ad2bb632f196c0936ef2af5ff6e273" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740", + "url": "https://api.github.com/repos/symfony/console/zipball/b504a3d266ad2bb632f196c0936ef2af5ff6e273", + "reference": "b504a3d266ad2bb632f196c0936ef2af5ff6e273", "shasum": "" }, "require": { @@ -2852,7 +2907,7 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], @@ -2873,7 +2928,7 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2023-07-19T20:11:33+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2881,12 +2936,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { @@ -2896,7 +2951,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -2925,7 +2980,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -2941,7 +2996,7 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3199,12 +3254,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fd9e963bb80ccbf5d83ce813f9058aacc67cdb98" + "reference": "f9c7affe77a00ae32ca127ca6833d034e6d33f25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd9e963bb80ccbf5d83ce813f9058aacc67cdb98", - "reference": "fd9e963bb80ccbf5d83ce813f9058aacc67cdb98", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f9c7affe77a00ae32ca127ca6833d034e6d33f25", + "reference": "f9c7affe77a00ae32ca127ca6833d034e6d33f25", "shasum": "" }, "require": { @@ -3275,7 +3330,7 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2023-01-30T17:25:47+00:00" }, { "name": "symfony/polyfill-php73", @@ -3447,12 +3502,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75" + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/aac98028c69df04ee77eb69b96b86ee51fbf4b75", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", "shasum": "" }, "require": { @@ -3462,14 +3517,11 @@ "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -3509,7 +3561,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" }, "funding": [ { @@ -3525,20 +3577,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/string", - "version": "6.3.x-dev", + "version": "6.4.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "295ef1f76d8afa41f63470f8c67e2ad4104c1abe" + "reference": "fe9228ba417441e16f31d36ddad2b3076135f453" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/295ef1f76d8afa41f63470f8c67e2ad4104c1abe", - "reference": "295ef1f76d8afa41f63470f8c67e2ad4104c1abe", + "url": "https://api.github.com/repos/symfony/string/zipball/fe9228ba417441e16f31d36ddad2b3076135f453", + "reference": "fe9228ba417441e16f31d36ddad2b3076135f453", "shasum": "" }, "require": { @@ -3552,11 +3604,11 @@ "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0", - "symfony/http-client": "^5.4|^6.0", - "symfony/intl": "^6.2", + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0" + "symfony/var-exporter": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -3595,7 +3647,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/6.3" + "source": "https://github.com/symfony/string/tree/6.4" }, "funding": [ { @@ -3611,7 +3663,7 @@ "type": "tidelift" } ], - "time": "2023-01-13T09:23:11+00:00" + "time": "2023-07-27T06:52:43+00:00" }, { "name": "theseer/tokenizer", diff --git a/src/Logger/Adapter/Sentry.php b/src/Logger/Adapter/Sentry.php index b8f93f1..9b15579 100644 --- a/src/Logger/Adapter/Sentry.php +++ b/src/Logger/Adapter/Sentry.php @@ -28,6 +28,48 @@ class Sentry extends Adapter */ protected string $sentryHost; + /** + * Sentry constructor. + * + * @param string $dsn + */ + public function __construct(string $dsn) + { + $parsedDsn = parse_url($dsn); + + if ($parsedDsn === false) { + throw new \Exception("The '$dsn' DSN is invalid."); + } + + $host = $parsedDsn['host'] ?? ''; + $path = $parsedDsn['path'] ?? ''; + $user = $parsedDsn['user'] ?? ''; + $scheme = $parsedDsn['scheme'] ?? ''; + + if (empty($scheme) || empty($host) || empty($path) || empty($user)) { + throw new \Exception("The '$dsn' DSN must contain a scheme, a host, a user and a path component."); + } + + if (! \in_array($scheme, ['http', 'https'], true)) { + throw new \Exception("The scheme of the $dsn DSN must be either 'http' or 'https'"); + } + + $segmentPaths = explode('/', $path); + $projectId = array_pop($segmentPaths); + + $url = $scheme.'://'.$host; + $port = $parsedDsn['port'] ?? ($scheme === 'http' ? 80 : 443); + if (($scheme === 'http' && $port !== 80) || + ($scheme === 'https' && $port !== 443) + ) { + $url .= ':'.$port; + } + + $this->sentryHost = $url; + $this->sentryKey = $user; + $this->projectId = $projectId; + } + /** * Return unique adapter name * @@ -145,23 +187,6 @@ public function push(Log $log): int return $response; } - /** - * Sentry constructor. - * - * @param string $configKey - */ - public function __construct(string $configKey) - { - $configChunks = \explode(';', $configKey); - $this->sentryKey = $configChunks[0]; - $this->projectId = $configChunks[1]; - $this->sentryHost = 'https://sentry.io'; - - if (count($configChunks) > 2 && ! empty($configChunks[2])) { - $this->sentryHost = $configChunks[2]; - } - } - public function getSupportedTypes(): array { return [ diff --git a/tests/LoggerTest.php b/tests/LoggerTest.php index a3a0d0c..f7f5f5d 100755 --- a/tests/LoggerTest.php +++ b/tests/LoggerTest.php @@ -156,7 +156,7 @@ public function testAdapters(): void $log->addExtra('line', '15'); // Test Sentry - $adapter = new Sentry(\getenv('TEST_SENTRY_KEY').';'.\getenv('TEST_SENTRY_PROJECT_ID').';'.\getenv('TEST_SENTRY_HOST')); + $adapter = new Sentry(\getenv('TEST_SENTRY_DSN') ?: ''); $logger = new Logger($adapter); $response = $logger->addLog($log); $this->assertEquals(200, $response);