2.什么是composer与packgist,composer的安装


学习地址:

http://www.houdunren.com/houdunren18_lesson_155?vid=10258npm

composer与packgist关系图片

composer的安装;

composer的下载地址:composer

连接:https://pan.baidu.com/s/1n3urR6dcNK9OsSNJ3OJD1g 密码:h0icless

因为国外网站,win下安装composer十分吃力
用comoposer离线安装包.
用法:
1. 按要求打开PHP的相关扩展:openssl.dll , mbstring.dll ,及PDO
2. 把php.exe所在目录的路径,加入环境变量,保证随处能够cmd下调用php命令.
3. 把本压缩包下的composer.bat,composer.phar解压放到php.exe相同的目录下.
测试:
打开cmd窗口 , composer -v ,看到以下相似信息,即宣告成功.
composer -v
   ______


  / ____/___  ____ ___  ____  ____  ________  _____


 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/


/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /


\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/


                    /_/


Composer version 1.2.1 2016-09-12 11:27:19

配置composer 修改国内镜像

由于composer的软件仓库位置在国外,因此咱们修改国内镜像,提升速度
composer config -g repositories.packagist composer https://packagist.phpcomposer.com学习

用composer安装与卸载插件

  1. 安装插件:
    composer require phpoffice/phpspreadsheet测试

  2. 卸载插件
    composer remove phpoffice/phpspreadsheet网站

composer插件升级后报错

composer插件升级后报错,[ReflectionException] Class Fxp\Composer\AssetPlugin\Repository\Npm
composer没法使用 [reflectionexception] class fxp\composer\assetplugin\repository\npmrepository does not existui

composer的plugin升级后,再使用composer会报错,好比直接在命令行中只输入composer会报错:插件

Deprecation Notice: The Composer\Package\LinkConstraint\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead. in phar:///usr/local/bin/composer/src/Composer/Package/LinkConstraint/MultiConstraint.php:17命令行

Deprecation Notice: The Composer\Package\LinkConstraint\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead. in phar:///usr/local/bin/composer/src/Composer/Package/LinkConstraint/LinkConstraintInterface.php:17

直接上报错的图:

或者再升级一下是这样的:

在网上搜了许多解决办法,但都不成功,直到……

重点来了,从上面报错的缘由中能够看到,上面提到了让你将目录切换到C:/Users/***/AppData/Roaming/Composer ,上面提到了有文件重复了,因此接下来要作的就是将C:\Users\Administrator\AppData\Roaming\Composer\vendor下面的fxp文件件直接删掉。从新打开cmd,再检查一下,看composer就能够用啦。

相关文章
相关标签/搜索