参考:
ThinkPHP6.0完全开发手册
先说说问题
执行ThinkPHP6的安装命令
composer create-project topthink/think tp
遇到问题汇总如下:
composer create-project topthink/think tp
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2
看提示是要更新版本,执行命令更新。
composer self-update
更新之后,再次安装ThinkPHP,之后遇到如下问题。
> @php think service:discover
[Error]
Class 'think\Paginator' not found
> @php think vendor:publish
[Error]
Class 'think\Paginator' not found
尝试了很多方法,依然不能解决。其中包括使用https://packagist.phpcomposer.com的镜像。
这时候遇到问题如下,
[InvalidArgumentException]
Could not find package topthink/think with stability stable.
最后解决方式为,更换了阿里云的镜像!所以归根结底还是因为…被墙了吧!(虽然翻墙了,但是也没行……)
好了,正确的方式如下:
一.运行环境要求
运行环境要求
PHP7.1+
。
Composer 2.0+
阿里的源https://mirrors.aliyun.com/composer/
二.配置
一、查看Composer 本身的源
composer config -g -l
二、更改为阿里的源
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
三、最后执行ThinkPHP6的下载操作
如图所示,搞定!艾玛~
最后补充一下解除镜象指令:
composer config -g --unset repos.packagist
执行之后,composer 会利用默认值(也就是官方源)重置源地址。
让人亲切的页面