windows環境下 composer 的安裝與使用

一、下載穩定版本 composer.phar 1.10.8 至 php 安裝目錄(即與 php.ini 同級)php

二、在 composer.phar 同目錄下 新建 composer.bat 文件,用記事本打開並輸入laravel

@php "%~dp0composer.phar" %*

三、配置 composer  !!! 因爲安裝了 php5.6 以及 php7.3 ,須指定 php.exe,如下操做皆在 php7.3 下運行  !!!git

# 查看 全局配置
./php.exe ./composer.phar config -g -l

# 重置 源
./php.exe ./composer.phar config -g --unset repositories.packagist

# 設置 阿里雲源
./php.exe ./composer.phar config -g repositories.packagist composer https://mirrors.aliyun.com/composer/

# 禁用 https 鏈接
./php.exe ./composer.phar config -g secure-http false

# 運行 診斷命令
./php.exe ./composer.phar diagnose

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: FAIL Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version: OK
Composer version: 1.10.8
PHP version: 7.3.11
PHP binary path: E:\php7.3\php.exe
OpenSSL version: OpenSSL 1.1.1d  10 Sep 2019

#配置 pubkey,按提示打開頁面並輸入兩次 pubkey 
./php.exe ./composer.phar self-update --update-keys

# 再次運行診斷命令
./php.exe ./composer.phar diagnose

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 1.10.8
PHP version: 7.3.11
PHP binary path: E:\php7.3\php.exe
OpenSSL version: OpenSSL 1.1.1d  10 Sep 2019

四、利用 composer 安裝 laravel 7github

./php.exe ./composer.phar create-project laravel/laravel /e/Apache/htdocs/laravel/

...
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
44 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan key:generate --ansi
Application key set successfully.
相關文章
相關標籤/搜索