I think this question is duplicated here and I tried suggestions on this link but not working with me so I want to know how to diagnose the issue so I can resolve the problem.
The following image is the important part of the output of composer diagnose
command which indicates that the https connectivity to packagist is failed
Checking https connectivity to packagist: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://repo.packagist.org/packages.json: Operation timed out after 10006 milliseconds with 0 out of 0 bytes received
and Checking github.com oauth access failed alse
Checking github.com oauth access: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://api.github.com/: Operation timed out after 10003 milliseconds with 0 out of 0 bytes received
Information might help: Operating System: windows 11 Composer version: 2.5.8 PHP version: 8.1.7 OpenSSL version: OpenSSL 1.1.1o 3 May 2022 cURL version: 7.77.0 libz 1.2.12 ssl OpenSSL/1.1.1o zip: extension present, unzip not available, 7-Zip not available
This is the full output of composer diagnose
>composer diag
Checking platform settings: OK
Checking git settings: OK git version 2.33.0
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://repo.packagist.org/packages.json: Operation timed out after 10000 milliseconds with 0 out of 0 bytes received
Checking github.com oauth access: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://api.github.com/: Operation timed out after 10008 milliseconds with 0 out of 0 bytes received
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E5CD41 7EC7CCC5 573900D0 8717B9A6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC74567 ECE52265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://getcomposer.org/versions: Operation timed out after 10010 milliseconds with 0 out of 0 bytes received
Composer version: 2.5.8
PHP version: 8.1.7
PHP binary path: A:\SwadiServer\php-8.1.7\php.exe
OpenSSL version: OpenSSL 1.1.1o 3 May 2022
cURL version: 7.77.0 libz 1.2.12 ssl OpenSSL/1.1.1o
zip: extension present, unzip not available, 7-Zip not available
I don't know what is the reason of the problem how to check if there is an port block by ISP because when I visit https://repo.packagist.org/packages.json on the browse it opened and on the terminal it has an issue with curl error timeout.
When I use the command curl https://repo.packagist.org/packages.json
it output the content of JSON as following:
{"packages":[],"notify-batch":"https://packagist.org/downloads/","providers-url":"/p/%package%$%hash%.json","metadata-url":"/p2/%package%.json","metadata-changes-url":"https://packagist.org/metadata/changes.json","search":"https://packagist.org/search.json?q=%query%&type=%type%","list":"https://packagist.org/packages/list.json","security-advisories":{"metadata":true,"api-url":"https://packagist.org/api/security-advisories/","query-all":true},"providers-api":"https://packagist.org/providers/%package%.json","warning":"Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/","warning-versions":"<1.99","info":"\u001b[37;44m#StandWith\u001b[30;43mUkraine\u001b[0m","provider-includes":{"p/provider-2013$%hash%.json":{"sha256":"8a29694e049e55d59398175f9865f74f814ef6f18561df7e4ed55d481bbffd55"},"p/provider-2014$%hash%.json":{"sha256":"983d741575411519a50469cf97ecd9b5daa03e2245ed5f2a95898f09ee14a4f6"},"p/provider-2015$%hash%.json":{"sha256":"80669bcdad1c7dfda950435f379143cec432e1f39ac6fa241bd15b9a314c18bf"},"p/provider-2016$%hash%.json":{"sha256":"0d91a5b10638c17953b7cbd01764a5777c8cc2a9d6ea9553cb9998b8f859decf"},"p/provider-2017$%hash%.json":{"sha256":"3260903a1f98b9093d06f5853cee88d2249785f913f215ce05c9d9137305ba88"},"p/provider-2018$%hash%.json":{"sha256":"213f8d51c38388a03b26a80bc26c30f192404d9777b8d67bc2305e1c63ed6c90"},"p/provider-2019$%hash%.json":{"sha256":"552a5f20f18cca366842851479fc2e3329a25797331af83ec5518c9b83f6c85d"},"p/provider-2020$%hash%.json":{"sha256":"1ce0786e752e10f63a1e6ce018eee9b3b97abcd23b759602fccce070adb446e3"},"p/provider-2021$%hash%.json":{"sha256":"a4fd371d659d3d7dfb9157bfc393ab2bd3a4a7a415d04b9a70b242e8c738d215"},"p/provider-2022$%hash%.json":{"sha256":"3d68b79ac7d2667a630b33fdcb02c29ec1085a41d63666072800e57848696115"},"p/provider-2022-10$%hash%.json":{"sha256":"194382abede763175257fd087eb2559c8aa76a4796ae9f87cc23d623c650eb2b"},"p/provider-2023-01$%hash%.json":{"sha256":"cab48a65d3b469e2f632656ef6c08e2db89f0c4963e57276d57427920a24cb07"},"p/provider-2023-04$%hash%.json":{"sha256":"6397a519b15160650aeb03eec8dc812b783ef2b60db9e9a36073073b0fa96d96"},"p/provider-2023-07$%hash%.json":{"sha256":"bf34a702a973364de3c08af910d954dc6c211861e7079d5755dcfb13e8639e2a"},"p/provider-archived$%hash%.json":{"sha256":"16aaa74e1529959dda7a45618413ac5144668fcbb5c367eabf52089e71e5bf18"},"p/provider-latest$%hash%.json":{"sha256":"148e7b9ddce4a1550e3fb031e7884eff80627c226cdadae15878c2e068fd772d"}}}