工学1号馆

home

« | 返回首页 | »

thinkphp5 使用composer 安装外部扩展

By Wu Yudong on November 27, 2018

tp5利用composer安装扩展很方便,具体怎么安装composer,可以自己百度。

首先在tp根目录的composer.json文件的‘require’中加入你需要安装的扩展,

    "require": {
        "php": ">=5.6.0",
        "topthink/framework": "5.1.*",
        "topthink/think-helper": "^1.0",
        "topthink/think-captcha": "^2.0",
        "topthink/think-image": "^1.0",
        "topthink/think-installer": "^1.0",
        "topthink/think-sae": "^1.1",
        "phpmailer/phpmailer": "^5.2",
        "yfcmf/geetest": "^1.0",
        "qiniu/php-sdk": "^7.1",
        "overtrue/wechat": "~3.1",
        "phpoffice/phpexcel": "^1.8",
	"riverslei/payment": "~2.0",
	"yfcmf/tp5-addons": "^1.0",
        "aliyuncs/oss-sdk-php": "^2.2.3",
        "flc/alidayu": "^2.0"
    },

比如”phpoffice/phpexcel”: “^1.8″,

然后在命令行工具切换到tp根目录输入composer update phpoffice/phpexcel 运行即可。

phpoffice类库就已经安装到vendor文件夹下,同时也会将其他没有安装的一起安装

如果文章对您有帮助,欢迎点击下方按钮打赏作者

Comments

No comments yet.
To verify that you are human, please fill in "七"(required)