2

I live in Iran, in last days because of internet limitations, I couldn't push into GitHub or GitLab, and also I couldn't use composer.

for GitHub and GitLab, I try SSH connection and SSH access key and I have no problems yet! but I can't use composer.

when I try this

composer create-project laravel/laravel starter-app

I get this

Creating a "laravel/laravel" project at "./starter-app"
Info from https://repo.packagist.org: #StandWithUkraine
Cannot use laravel/laravel's latest version v9.3.8 as it requires PHP ^8.0.2 which is not satisfied by your platform.
Installing laravel/laravel (v8.6.12)
  - Downloading laravel/laravel (v8.6.12)
  - Downloading laravel/laravel (v8.6.12)
  - Downloading laravel/laravel (v8.6.12)
  - Downloading laravel/laravel (v8.6.12)
    Failed to download laravel/laravel from dist: curl error 28 while downloading https://codeload.github.com/laravel/laravel/legacy.zip/843a4f81eb25b88b225a89d75a2d3c274e81be6b: Operation timed out after 10000 milliseconds with 0 out of 0 bytes received
    Now trying to download from source
  - Syncing laravel/laravel (v8.6.12) into cache
Cloning failed using an SSH key for authentication, enter your GitHub credentials to access private repos
When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+DESKTOP-RRHGV12+2022-10-11+1350 to retrieve a token.
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+DESKTOP-RRHGV12+2022-10-11+1350
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "C:/Users/VIRA-PC03/AppData/Roaming/Composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden): 

I go to this link "https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth" and generate new token and paste it, but nothing happen and also I can't use composer

also I try this command composer diagnose and get this

Checking platform settings: OK
Checking git settings: OK git version 2.29.2
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://api.github.com/: Operation timed out after 10000 milliseconds with 0 out of 0 bytes received
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: some number with spaces
Dev Public Key Fingerprint: some number with spaces
OK
Checking composer version: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://getcomposer.org/versions: Operation timed out after 10008 milliseconds with 0 out of 0 bytes received
Composer version: 2.4.2
PHP version: 7.4.12
PHP binary path: C:\xampp\php\php.exe
OpenSSL version: OpenSSL 1.1.1h  22 Sep 2020
cURL version: 7.70.0 libz 1.2.11 ssl OpenSSL/1.1.1h
zip: extension present, unzip not available, 7-Zip not available

and I go to C:\users<my-user>\AppData\Roaming\composer and create file "auth.json" and put this into it

{
    "github-oauth": {
        "github.com": "my token"
    }
}

but I can't get or install Laravel or any other package like phpspeadsheet using composer.

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Amirhoseinh73
  • 409
  • 5
  • 14
  • You found a solution yet ? – xperator Oct 21 '22 at 17:41
  • Does this answer your question? [curl error 28 for composer update/install laravel](https://stackoverflow.com/questions/73980617/curl-error-28-for-composer-update-install-laravel) – hakre Oct 22 '22 at 06:29
  • @hakre No, I'm using windows 10, I tried all suggested ways and my problem still there! I bought a vpn 3 days ago and now I can use composer but vpn speed is very low. – Amirhoseinh73 Oct 22 '22 at 08:40
  • @AmirhosseinHassani: _"I couldn't push into GitHub or GitLab"_ -> contact their support if they still offer services for your location. Also contact your telco if they still offer internet for these services. Because if any of them don't you're likely required to re-route your traffic through a VPN to connect. The speed there depends on the infrastructure and yes, speed is slow over network, increase composers cache size (300 MB by default IIRC) and work offline unless you need to sync. – hakre Oct 22 '22 at 09:20
  • @xperator I bought a VPN and my problem solved for now! – Amirhoseinh73 Oct 23 '22 at 06:13
  • @hakre please read my question carefully! github and gitlab are OK with SSH, my problem is Composer and without VPN, composer don't work in my location! – Amirhoseinh73 Oct 23 '22 at 06:18

1 Answers1

2

you can use this website https://www.vpngate.net/ to get the vpn. and use vpn to update composer. or you can copy vendor folder form other project and copy it to your project.

Dharman
  • 30,962
  • 25
  • 85
  • 135
ashkan
  • 46
  • 4