From 570070596df879a88d850c8a79a553aa9ddb6f03 Mon Sep 17 00:00:00 2001 From: Rifki Alhuraibi Date: Wed, 24 Feb 2021 07:35:44 +0700 Subject: [PATCH 1/2] feature: add customizable hash key for model --- composer.lock | 1000 ++++++++++++++++++++++++---- src/Eloquent/HashableId.php | 18 +- src/Repository.php | 1 + tests/Models/CustomKeyModel.php | 8 + tests/Unit/HashableIdModelTest.php | 11 +- 5 files changed, 889 insertions(+), 149 deletions(-) create mode 100644 tests/Models/CustomKeyModel.php diff --git a/composer.lock b/composer.lock index e1ed844..c1a3c9d 100644 --- a/composer.lock +++ b/composer.lock @@ -504,16 +504,16 @@ }, { "name": "laravel/framework", - "version": "v8.26.1", + "version": "v8.29.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "275c78c97e007e4a9d771d4d1caa1c77ebfdcf94" + "reference": "d2eba352b3b3a3c515b18c5726b373fe5026733e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/275c78c97e007e4a9d771d4d1caa1c77ebfdcf94", - "reference": "275c78c97e007e4a9d771d4d1caa1c77ebfdcf94", + "url": "https://api.github.com/repos/laravel/framework/zipball/d2eba352b3b3a3c515b18c5726b373fe5026733e", + "reference": "d2eba352b3b3a3c515b18c5726b373fe5026733e", "shasum": "" }, "require": { @@ -621,7 +621,7 @@ "phpunit/phpunit": "Required to use assertions and run tests (^8.5.8|^9.3.3).", "predis/predis": "Required to use the predis connector (^1.1.2).", "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", - "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0|^5.0).", "symfony/cache": "Required to PSR-6 cache bridge (^5.1.4).", "symfony/filesystem": "Required to enable support for relative symbolic links (^5.1.4).", "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).", @@ -668,7 +668,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-02-02T14:07:24+00:00" + "time": "2021-02-23T14:27:41+00:00" }, { "name": "league/commonmark", @@ -1020,16 +1020,16 @@ }, { "name": "nesbot/carbon", - "version": "2.44.0", + "version": "2.45.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "e6ef33cb1f67a4bed831ed6d0f7e156739a5d8cd" + "reference": "528783b188bdb853eb21239b1722831e0f000a8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/e6ef33cb1f67a4bed831ed6d0f7e156739a5d8cd", - "reference": "e6ef33cb1f67a4bed831ed6d0f7e156739a5d8cd", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/528783b188bdb853eb21239b1722831e0f000a8d", + "reference": "528783b188bdb853eb21239b1722831e0f000a8d", "shasum": "" }, "require": { @@ -1109,7 +1109,7 @@ "type": "tidelift" } ], - "time": "2021-01-26T20:46:41+00:00" + "time": "2021-02-11T18:30:17+00:00" }, { "name": "opis/closure", @@ -1695,16 +1695,16 @@ }, { "name": "symfony/console", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "d62ec79478b55036f65e2602e282822b8eaaff0a" + "reference": "89d4b176d12a2946a1ae4e34906a025b7b6b135a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/d62ec79478b55036f65e2602e282822b8eaaff0a", - "reference": "d62ec79478b55036f65e2602e282822b8eaaff0a", + "url": "https://api.github.com/repos/symfony/console/zipball/89d4b176d12a2946a1ae4e34906a025b7b6b135a", + "reference": "89d4b176d12a2946a1ae4e34906a025b7b6b135a", "shasum": "" }, "require": { @@ -1772,7 +1772,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.2.2" + "source": "https://github.com/symfony/console/tree/v5.2.3" }, "funding": [ { @@ -1788,11 +1788,11 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:15:41+00:00" + "time": "2021-01-28T22:06:19+00:00" }, { "name": "symfony/css-selector", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -1837,7 +1837,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v5.2.2" + "source": "https://github.com/symfony/css-selector/tree/v5.2.3" }, "funding": [ { @@ -1924,16 +1924,16 @@ }, { "name": "symfony/error-handler", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "4fd4a377f7b7ec7c3f3b40346a1411e0a83f9d40" + "reference": "48f18b3609e120ea66d59142c23dc53e9562c26d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/4fd4a377f7b7ec7c3f3b40346a1411e0a83f9d40", - "reference": "4fd4a377f7b7ec7c3f3b40346a1411e0a83f9d40", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/48f18b3609e120ea66d59142c23dc53e9562c26d", + "reference": "48f18b3609e120ea66d59142c23dc53e9562c26d", "shasum": "" }, "require": { @@ -1973,7 +1973,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.2.2" + "source": "https://github.com/symfony/error-handler/tree/v5.2.3" }, "funding": [ { @@ -1989,11 +1989,11 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:15:41+00:00" + "time": "2021-01-28T22:06:19+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -2058,7 +2058,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.2.2" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.2.3" }, "funding": [ { @@ -2157,16 +2157,16 @@ }, { "name": "symfony/finder", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "196f45723b5e618bf0e23b97e96d11652696ea9e" + "reference": "4adc8d172d602008c204c2e16956f99257248e03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/196f45723b5e618bf0e23b97e96d11652696ea9e", - "reference": "196f45723b5e618bf0e23b97e96d11652696ea9e", + "url": "https://api.github.com/repos/symfony/finder/zipball/4adc8d172d602008c204c2e16956f99257248e03", + "reference": "4adc8d172d602008c204c2e16956f99257248e03", "shasum": "" }, "require": { @@ -2198,7 +2198,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.2.2" + "source": "https://github.com/symfony/finder/tree/v5.2.3" }, "funding": [ { @@ -2214,7 +2214,7 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:01:46+00:00" + "time": "2021-01-28T22:06:19+00:00" }, { "name": "symfony/http-client-contracts", @@ -2297,16 +2297,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "16dfa5acf8103f0394d447f8eea3ea49f9e50855" + "reference": "20c554c0f03f7cde5ce230ed248470cccbc34c36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/16dfa5acf8103f0394d447f8eea3ea49f9e50855", - "reference": "16dfa5acf8103f0394d447f8eea3ea49f9e50855", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/20c554c0f03f7cde5ce230ed248470cccbc34c36", + "reference": "20c554c0f03f7cde5ce230ed248470cccbc34c36", "shasum": "" }, "require": { @@ -2350,7 +2350,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.2.2" + "source": "https://github.com/symfony/http-foundation/tree/v5.2.3" }, "funding": [ { @@ -2366,20 +2366,20 @@ "type": "tidelift" } ], - "time": "2021-01-27T11:19:04+00:00" + "time": "2021-02-03T04:42:09+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "831b51e9370ece0febd0950dd819c63f996721c7" + "reference": "89bac04f29e7b0b52f9fa6a4288ca7a8f90a1a05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/831b51e9370ece0febd0950dd819c63f996721c7", - "reference": "831b51e9370ece0febd0950dd819c63f996721c7", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/89bac04f29e7b0b52f9fa6a4288ca7a8f90a1a05", + "reference": "89bac04f29e7b0b52f9fa6a4288ca7a8f90a1a05", "shasum": "" }, "require": { @@ -2462,7 +2462,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.2.2" + "source": "https://github.com/symfony/http-kernel/tree/v5.2.3" }, "funding": [ { @@ -2478,20 +2478,20 @@ "type": "tidelift" } ], - "time": "2021-01-27T14:45:46+00:00" + "time": "2021-02-03T04:51:58+00:00" }, { "name": "symfony/mime", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "37bade585ea100d235c031b258eff93b5b6bb9a9" + "reference": "7dee6a43493f39b51ff6c5bb2bd576fe40a76c86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/37bade585ea100d235c031b258eff93b5b6bb9a9", - "reference": "37bade585ea100d235c031b258eff93b5b6bb9a9", + "url": "https://api.github.com/repos/symfony/mime/zipball/7dee6a43493f39b51ff6c5bb2bd576fe40a76c86", + "reference": "7dee6a43493f39b51ff6c5bb2bd576fe40a76c86", "shasum": "" }, "require": { @@ -2544,7 +2544,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.2.2" + "source": "https://github.com/symfony/mime/tree/v5.2.3" }, "funding": [ { @@ -2560,11 +2560,11 @@ "type": "tidelift" } ], - "time": "2021-01-25T14:08:25+00:00" + "time": "2021-02-02T06:10:15+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -2623,7 +2623,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" }, "funding": [ { @@ -2643,16 +2643,16 @@ }, { "name": "symfony/polyfill-iconv", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "b34bfb8c4c22650ac080d2662ae3502e5f2f4ae6" + "reference": "06fb361659649bcfd6a208a0f1fcaf4e827ad342" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/b34bfb8c4c22650ac080d2662ae3502e5f2f4ae6", - "reference": "b34bfb8c4c22650ac080d2662ae3502e5f2f4ae6", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/06fb361659649bcfd6a208a0f1fcaf4e827ad342", + "reference": "06fb361659649bcfd6a208a0f1fcaf4e827ad342", "shasum": "" }, "require": { @@ -2703,7 +2703,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-iconv/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.22.1" }, "funding": [ { @@ -2719,20 +2719,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-01-22T09:19:47+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "267a9adeb8ecb8071040a740930e077cdfb987af" + "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/267a9adeb8ecb8071040a740930e077cdfb987af", - "reference": "267a9adeb8ecb8071040a740930e077cdfb987af", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5601e09b69f26c1828b13b6bb87cb07cddba3170", + "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170", "shasum": "" }, "require": { @@ -2784,7 +2784,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.1" }, "funding": [ { @@ -2800,20 +2800,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-01-22T09:19:47+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "0eb8293dbbcd6ef6bf81404c9ce7d95bcdf34f44" + "reference": "2d63434d922daf7da8dd863e7907e67ee3031483" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/0eb8293dbbcd6ef6bf81404c9ce7d95bcdf34f44", - "reference": "0eb8293dbbcd6ef6bf81404c9ce7d95bcdf34f44", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/2d63434d922daf7da8dd863e7907e67ee3031483", + "reference": "2d63434d922daf7da8dd863e7907e67ee3031483", "shasum": "" }, "require": { @@ -2871,7 +2871,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.22.1" }, "funding": [ { @@ -2887,20 +2887,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-01-22T09:19:47+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "6e971c891537eb617a00bb07a43d182a6915faba" + "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/6e971c891537eb617a00bb07a43d182a6915faba", - "reference": "6e971c891537eb617a00bb07a43d182a6915faba", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/43a0283138253ed1d48d352ab6d0bdb3f809f248", + "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248", "shasum": "" }, "require": { @@ -2955,7 +2955,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.1" }, "funding": [ { @@ -2971,20 +2971,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T17:09:11+00:00" + "time": "2021-01-22T09:19:47+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13" + "reference": "5232de97ee3b75b0360528dae24e73db49566ab1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", - "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/5232de97ee3b75b0360528dae24e73db49566ab1", + "reference": "5232de97ee3b75b0360528dae24e73db49566ab1", "shasum": "" }, "require": { @@ -3035,7 +3035,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.1" }, "funding": [ { @@ -3051,11 +3051,11 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-01-22T09:19:47+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", @@ -3111,7 +3111,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.22.1" }, "funding": [ { @@ -3131,7 +3131,7 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", @@ -3190,7 +3190,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.1" }, "funding": [ { @@ -3210,7 +3210,7 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", @@ -3273,7 +3273,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1" }, "funding": [ { @@ -3293,7 +3293,7 @@ }, { "name": "symfony/process", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -3335,7 +3335,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.2.2" + "source": "https://github.com/symfony/process/tree/v5.2.3" }, "funding": [ { @@ -3355,7 +3355,7 @@ }, { "name": "symfony/routing", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", @@ -3425,7 +3425,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v5.2.2" + "source": "https://github.com/symfony/routing/tree/v5.2.3" }, "funding": [ { @@ -3524,7 +3524,7 @@ }, { "name": "symfony/string", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", @@ -3587,7 +3587,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.2.2" + "source": "https://github.com/symfony/string/tree/v5.2.3" }, "funding": [ { @@ -3607,7 +3607,7 @@ }, { "name": "symfony/translation", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", @@ -3680,7 +3680,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.2.2" + "source": "https://github.com/symfony/translation/tree/v5.2.3" }, "funding": [ { @@ -3778,7 +3778,7 @@ }, { "name": "symfony/var-dumper", - "version": "v5.2.2", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", @@ -3846,7 +3846,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.2.2" + "source": "https://github.com/symfony/var-dumper/tree/v5.2.3" }, "funding": [ { @@ -4247,6 +4247,81 @@ }, "time": "2020-12-18T16:50:48+00:00" }, + { + "name": "guzzlehttp/psr7", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/1.7.0" + }, + "time": "2020-09-30T07:37:11+00:00" + }, { "name": "hamcrest/hamcrest-php", "version": "v2.0.1", @@ -4486,24 +4561,25 @@ }, { "name": "orchestra/testbench", - "version": "v6.7.2", + "version": "v6.13.0", "source": { "type": "git", "url": "https://github.com/orchestral/testbench.git", - "reference": "9d835af2510b4c581a8eb2952ef7412ed1e6a727" + "reference": "ad3dbdf82bb3327a7b65d6191b88d0ddb3f98143" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench/zipball/9d835af2510b4c581a8eb2952ef7412ed1e6a727", - "reference": "9d835af2510b4c581a8eb2952ef7412ed1e6a727", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/ad3dbdf82bb3327a7b65d6191b88d0ddb3f98143", + "reference": "ad3dbdf82bb3327a7b65d6191b88d0ddb3f98143", "shasum": "" }, "require": { - "laravel/framework": "^8.18.1", - "mockery/mockery": "^1.3.2", - "orchestra/testbench-core": "^6.9.2", - "php": ">=7.3 || >=8.0", - "phpunit/phpunit": "^8.4 || ^9.0" + "laravel/framework": "^8.25", + "mockery/mockery": "^1.4.2", + "orchestra/testbench-core": "^6.16", + "php": "^7.3 || ^8.0", + "phpunit/phpunit": "^8.4 || ^9.3.3", + "spatie/laravel-ray": "^1.9.3" }, "type": "library", "extra": { @@ -4523,7 +4599,7 @@ } ], "description": "Laravel Testing Helper for Packages Development", - "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", + "homepage": "https://packages.tools/testbench/", "keywords": [ "BDD", "TDD", @@ -4534,7 +4610,7 @@ ], "support": { "issues": "https://github.com/orchestral/testbench/issues", - "source": "https://github.com/orchestral/testbench/tree/v6.7.2" + "source": "https://github.com/orchestral/testbench/tree/v6.13.0" }, "funding": [ { @@ -4546,41 +4622,41 @@ "type": "liberapay" } ], - "time": "2020-12-30T12:57:51+00:00" + "time": "2021-02-21T14:16:16+00:00" }, { "name": "orchestra/testbench-core", - "version": "v6.9.2", + "version": "v6.16.0", "source": { "type": "git", "url": "https://github.com/orchestral/testbench-core.git", - "reference": "389f145f7afbebc77765f3ef5d5af748fef0eebf" + "reference": "c0297f31b95ba6e0f0e96d3c67d882d30680c83d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/389f145f7afbebc77765f3ef5d5af748fef0eebf", - "reference": "389f145f7afbebc77765f3ef5d5af748fef0eebf", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/c0297f31b95ba6e0f0e96d3c67d882d30680c83d", + "reference": "c0297f31b95ba6e0f0e96d3c67d882d30680c83d", "shasum": "" }, "require": { "fakerphp/faker": "^1.9.1", - "php": ">=7.2.5 || >=8.0", - "symfony/yaml": "^4.3 || ^5.0", + "php": "^7.3 || ^8.0", + "symfony/yaml": "^5.0", "vlucas/phpdotenv": "^5.1" }, "require-dev": { - "laravel/framework": "^8.0", + "laravel/framework": "^8.26", "laravel/laravel": "8.x-dev", - "mockery/mockery": "^1.3.2", - "orchestra/canvas": "^6.0", - "phpunit/phpunit": "^8.4 || ^9.0" + "mockery/mockery": "^1.4.2", + "orchestra/canvas": "^6.1", + "phpunit/phpunit": "^8.4 || ^9.3.3" }, "suggest": { - "laravel/framework": "Required for testing (^8.0).", - "mockery/mockery": "Allow using Mockery for testing (^1.3.2).", + "laravel/framework": "Required for testing (^8.26).", + "mockery/mockery": "Allow using Mockery for testing (^1.4.2).", "orchestra/testbench-browser-kit": "Allow using legacy Laravel BrowserKit for testing (^6.0).", "orchestra/testbench-dusk": "Allow using Laravel Dusk for testing (^6.0).", - "phpunit/phpunit": "Allow using PHPUnit for testing (^8.4 || ^9.0)." + "phpunit/phpunit": "Allow using PHPUnit for testing (^8.4|^9.3.3)." }, "bin": [ "testbench" @@ -4589,6 +4665,11 @@ "extra": { "branch-alias": { "dev-master": "6.0-dev" + }, + "laravel": { + "providers": [ + "Orchestra\\Testbench\\Foundation\\TestbenchServiceProvider" + ] } }, "autoload": { @@ -4608,7 +4689,7 @@ } ], "description": "Testing Helper for Laravel Development", - "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", + "homepage": "https://packages.tools/testbench", "keywords": [ "BDD", "TDD", @@ -4631,7 +4712,7 @@ "type": "liberapay" } ], - "time": "2020-12-30T12:42:02+00:00" + "time": "2021-02-21T04:20:45+00:00" }, { "name": "phar-io/manifest", @@ -4695,16 +4776,16 @@ }, { "name": "phar-io/version", - "version": "3.0.4", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" + "reference": "bae7c545bef187884426f042434e561ab1ddb182" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", + "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", + "reference": "bae7c545bef187884426f042434e561ab1ddb182", "shasum": "" }, "require": { @@ -4740,9 +4821,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.0.4" + "source": "https://github.com/phar-io/version/tree/3.1.0" }, - "time": "2020-12-13T23:18:30+00:00" + "time": "2021-02-23T14:00:09+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -5289,16 +5370,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.0", + "version": "9.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe" + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8e16c225d57c3d6808014df6b1dd7598d0a5bbbe", - "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4", + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4", "shasum": "" }, "require": { @@ -5376,7 +5457,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.0" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.2" }, "funding": [ { @@ -5388,7 +5469,104 @@ "type": "github" } ], - "time": "2020-12-04T05:05:53+00:00" + "time": "2021-02-02T14:45:58+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.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": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" }, { "name": "sebastian/cli-parser", @@ -6354,18 +6532,347 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "spatie/backtrace", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/backtrace.git", + "reference": "3440fe023a7d5b4497090fb6b2dcdc747daf7873" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/backtrace/zipball/3440fe023a7d5b4497090fb6b2dcdc747daf7873", + "reference": "3440fe023a7d5b4497090fb6b2dcdc747daf7873", + "shasum": "" + }, + "require": { + "php": "^7.3|^8.0" + }, + "require-dev": { + "ext-json": "*", + "phpunit/phpunit": "^9.3", + "symfony/var-dumper": "^5.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\Backtrace\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van de Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "A better backtrace", + "homepage": "https://github.com/spatie/backtrace", + "keywords": [ + "Backtrace", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/backtrace/issues", + "source": "https://github.com/spatie/backtrace/tree/1.1.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spatie", + "type": "github" + }, + { + "url": "https://spatie.be/open-source/support-us", + "type": "other" + } + ], + "time": "2021-01-29T09:20:43+00:00" + }, + { + "name": "spatie/laravel-ray", + "version": "1.13.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-ray.git", + "reference": "1c5bc1785a06dac98fdbdff0b067a126dd6a81d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-ray/zipball/1c5bc1785a06dac98fdbdff0b067a126dd6a81d0", + "reference": "1c5bc1785a06dac98fdbdff0b067a126dd6a81d0", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/contracts": "^7.20|^8.0", + "illuminate/database": "^7.20|^8.13", + "illuminate/queue": "^7.20|^8.13", + "illuminate/support": "^7.20|^8.13", + "php": "^7.3|^8.0", + "spatie/backtrace": "^1.0", + "spatie/ray": "^1.20", + "symfony/stopwatch": "4.2|^5.1", + "zbateson/mail-mime-parser": "^1.3.1" + }, + "require-dev": { + "facade/ignition": "^2.5", + "laravel/framework": "^7.20|^8.19", + "orchestra/testbench-core": "^5.0|^6.0", + "phpunit/phpunit": "^9.3", + "spatie/phpunit-snapshot-assertions": "^4.2" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\LaravelRay\\RayServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Spatie\\LaravelRay\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Easily debug Laravel apps", + "homepage": "https://github.com/spatie/laravel-ray", + "keywords": [ + "laravel-ray", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-ray/issues", + "source": "https://github.com/spatie/laravel-ray/tree/1.13.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spatie", + "type": "github" + }, + { + "url": "https://spatie.be/open-source/support-us", + "type": "other" + } + ], + "time": "2021-02-22T12:05:12+00:00" + }, + { + "name": "spatie/macroable", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/macroable.git", + "reference": "7a99549fc001c925714b329220dea680c04bfa48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/macroable/zipball/7a99549fc001c925714b329220dea680c04bfa48", + "reference": "7a99549fc001c925714b329220dea680c04bfa48", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0|^9.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\Macroable\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "A trait to dynamically add methods to a class", + "homepage": "https://github.com/spatie/macroable", + "keywords": [ + "macroable", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/macroable/issues", + "source": "https://github.com/spatie/macroable/tree/1.0.1" + }, + "time": "2020-11-03T10:15:05+00:00" + }, + { + "name": "spatie/ray", + "version": "1.20.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/ray.git", + "reference": "27400a44a1130e660a07b374a10dd96db70d6d0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/ray/zipball/27400a44a1130e660a07b374a10dd96db70d6d0a", + "reference": "27400a44a1130e660a07b374a10dd96db70d6d0a", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "php": "^7.3|^8.0", + "ramsey/uuid": "^3.0|^4.1", + "spatie/backtrace": "^1.1", + "spatie/macroable": "^1.0", + "symfony/stopwatch": "^4.0|^5.1", + "symfony/var-dumper": "^4.2|^5.1" + }, + "require-dev": { + "illuminate/support": "6.x|^8.18", + "nesbot/carbon": "^2.43", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.9.16", + "spatie/phpunit-snapshot-assertions": "^4.2", + "spatie/test-time": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\Ray\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Debug with Ray to fix problems faster", + "homepage": "https://github.com/spatie/ray", + "keywords": [ + "ray", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/ray/issues", + "source": "https://github.com/spatie/ray/tree/1.20.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spatie", + "type": "github" + }, + { + "url": "https://spatie.be/open-source/support-us", + "type": "other" + } + ], + "time": "2021-02-22T12:01:10+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v5.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "b12274acfab9d9850c52583d136a24398cdf1a0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/b12274acfab9d9850c52583d136a24398cdf1a0c", + "reference": "b12274acfab9d9850c52583d136a24398cdf1a0c", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/service-contracts": "^1.0|^2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v5.2.3" + }, + "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": "2021-01-27T10:15:41+00:00" + }, { "name": "symfony/yaml", - "version": "v5.2.1", + "version": "v5.2.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "290ea5e03b8cf9b42c783163123f54441fb06939" + "reference": "338cddc6d74929f6adf19ca5682ac4b8e109cdb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/290ea5e03b8cf9b42c783163123f54441fb06939", - "reference": "290ea5e03b8cf9b42c783163123f54441fb06939", + "url": "https://api.github.com/repos/symfony/yaml/zipball/338cddc6d74929f6adf19ca5682ac4b8e109cdb0", + "reference": "338cddc6d74929f6adf19ca5682ac4b8e109cdb0", "shasum": "" }, "require": { @@ -6408,10 +6915,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.2.1" + "source": "https://github.com/symfony/yaml/tree/v5.2.3" }, "funding": [ { @@ -6427,7 +6934,7 @@ "type": "tidelift" } ], - "time": "2020-12-08T17:02:38+00:00" + "time": "2021-02-03T04:42:09+00:00" }, { "name": "theseer/tokenizer", @@ -6478,6 +6985,209 @@ } ], "time": "2020-07-12T23:59:07+00:00" + }, + { + "name": "zbateson/mail-mime-parser", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/zbateson/mail-mime-parser.git", + "reference": "706964d904798b8c22d63f62f0ec5f5bc84e30d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zbateson/mail-mime-parser/zipball/706964d904798b8c22d63f62f0ec5f5bc84e30d9", + "reference": "706964d904798b8c22d63f62f0ec5f5bc84e30d9", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^1.0", + "php": ">=5.4", + "zbateson/mb-wrapper": "^1.0.1", + "zbateson/stream-decorators": "^1.0.4" + }, + "require-dev": { + "jms/serializer": "^1.1", + "mikey179/vfsstream": "^1.6.0", + "phing/phing": "^2.15.0", + "phpdocumentor/phpdocumentor": "^2.9.0", + "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5" + }, + "suggest": { + "ext-iconv": "For best support/performance", + "ext-mbstring": "For best support/performance" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZBateson\\MailMimeParser\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Zaahid Bateson" + }, + { + "name": "Contributors", + "homepage": "https://github.com/zbateson/mail-mime-parser/graphs/contributors" + } + ], + "description": "MIME email message parser", + "homepage": "https://mail-mime-parser.org", + "keywords": [ + "MimeMailParser", + "email", + "mail", + "mailparse", + "mime", + "mimeparse", + "parser", + "php-imap" + ], + "support": { + "docs": "https://mail-mime-parser.org/#usage-guide", + "issues": "https://github.com/zbateson/mail-mime-parser/issues", + "source": "https://github.com/zbateson/mail-mime-parser" + }, + "funding": [ + { + "url": "https://github.com/zbateson", + "type": "github" + } + ], + "time": "2020-12-02T21:55:45+00:00" + }, + { + "name": "zbateson/mb-wrapper", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/zbateson/mb-wrapper.git", + "reference": "721b3dfbf7ab75fee5ac60a542d7923ffe59ef6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zbateson/mb-wrapper/zipball/721b3dfbf7ab75fee5ac60a542d7923ffe59ef6d", + "reference": "721b3dfbf7ab75fee5ac60a542d7923ffe59ef6d", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "symfony/polyfill-iconv": "^1.9", + "symfony/polyfill-mbstring": "^1.9" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5" + }, + "suggest": { + "ext-iconv": "For best support/performance", + "ext-mbstring": "For best support/performance" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZBateson\\MbWrapper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Zaahid Bateson" + } + ], + "description": "Wrapper for mbstring with fallback to iconv for encoding conversion and string manipulation", + "keywords": [ + "charset", + "encoding", + "http", + "iconv", + "mail", + "mb", + "mb_convert_encoding", + "mbstring", + "mime", + "multibyte", + "string" + ], + "support": { + "issues": "https://github.com/zbateson/mb-wrapper/issues", + "source": "https://github.com/zbateson/mb-wrapper/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/zbateson", + "type": "github" + } + ], + "time": "2020-10-21T22:14:27+00:00" + }, + { + "name": "zbateson/stream-decorators", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/zbateson/stream-decorators.git", + "reference": "6f54738dfecc65e1d5bfb855035836748083a6dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zbateson/stream-decorators/zipball/6f54738dfecc65e1d5bfb855035836748083a6dd", + "reference": "6f54738dfecc65e1d5bfb855035836748083a6dd", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^1.0.0", + "php": ">=5.4", + "zbateson/mb-wrapper": "^1.0.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZBateson\\StreamDecorators\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Zaahid Bateson" + } + ], + "description": "PHP psr7 stream decorators for mime message part streams", + "keywords": [ + "base64", + "charset", + "decorators", + "mail", + "mime", + "psr7", + "quoted-printable", + "stream", + "uuencode" + ], + "support": { + "issues": "https://github.com/zbateson/stream-decorators/issues", + "source": "https://github.com/zbateson/stream-decorators/tree/master" + }, + "funding": [ + { + "url": "https://github.com/zbateson", + "type": "github" + } + ], + "time": "2020-08-10T18:59:43+00:00" } ], "aliases": [], diff --git a/src/Eloquent/HashableId.php b/src/Eloquent/HashableId.php index 97344ca..4705d92 100644 --- a/src/Eloquent/HashableId.php +++ b/src/Eloquent/HashableId.php @@ -61,7 +61,7 @@ public static function byHashOrFail($hash): self public function getHashAttribute(): string { return $this->getHashIdRepository() - ->idToHash($this->getKey(), static::class); + ->idToHash($this->getKey(), $this->getHashKey()); } /** @@ -74,7 +74,19 @@ public static function hashToId(string $hash): ?int { return (new static) ->getHashIdRepository() - ->hashToId($hash, static::class); + ->hashToId($hash, (new static)->getHashKey()); + } + + /** + * Get Hash Key/. + * + * @return string + */ + public function getHashKey(): string + { + return property_exists($this, 'hashKey') + ? $this->hashKey + : static::class; } /** @@ -87,7 +99,7 @@ public static function idToHash(int $primaryKey): string { return (new static) ->getHashIdRepository() - ->idToHash($primaryKey, static::class); + ->idToHash($primaryKey, (new static)->getHashKey()); } /** diff --git a/src/Repository.php b/src/Repository.php index 493691b..9db3135 100644 --- a/src/Repository.php +++ b/src/Repository.php @@ -25,6 +25,7 @@ public function all(): array public function hashToId(string $hash, string $key = 'default'): ?int { $result = $this->get($key)->decode($hash); + return $result[0] ?? null; } diff --git a/tests/Models/CustomKeyModel.php b/tests/Models/CustomKeyModel.php new file mode 100644 index 0000000..844f35b --- /dev/null +++ b/tests/Models/CustomKeyModel.php @@ -0,0 +1,8 @@ +expectException(ValidationException::class); $validator->validate(); - } public function test_validation_on_persisting_model() @@ -158,6 +158,15 @@ public function test_validation_on_persisting_model() $validator->validate(); } + public function test_custom_key_model() + { + $m = new CustomKeyModel(); + $m->save(); + + $this->assertEquals('somethingUnique', $m->getHashKey()); + $this->assertEquals(CustomKeyModel::idToHash($m->getKey()), $m->hash); + } + protected function getRepository(): Repository { return app('app.hashid'); From d29599e139e78c75b08290791033ca5fc1d51c3e Mon Sep 17 00:00:00 2001 From: Rifki Alhuraibi Date: Wed, 24 Feb 2021 07:41:19 +0700 Subject: [PATCH 2/2] update readme --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e0b82a..91ec3bb 100644 --- a/README.md +++ b/README.md @@ -91,13 +91,29 @@ HashId::idToHash($id, User::class) // same as User::idToHash($hash); However you can opt-out to not using any eloquent model or implementing your own logic to the repository. ```php - HashId::make($key, $salt); // will return \HashId\HashId class. // once you instantiated the object, you can retrieve it on your next operation HashId::get($key); ``` +If you're using single table inheritance model, where you want to has the same calculated hash across all inherited models, use `$hashKey` property, this will result the calculation remain the same across all inherited model. + +```php +class User extends Model { + protected $hashKey = 'somethingUnique'; +} + +class Customer extends Customer { + +} + +$customer = Customer::find(1); +$user = User::find(1); + +$user->hash; // will be equal to $customer->hash +``` + You can also specify the length and characters of the hashed Id with `HASHID_LENGTH` and `HASHID_ALPHABET` environment variable respectively, or you can publish the configuration file using this command: ```bash @@ -120,3 +136,7 @@ Validator::make([ ]); ... ``` + +#### License + +MIT License