composer安装

composer安装的步骤

首先去http://www.phpcomposer.com/ 点击下载进入https://getcomposer.org/download/ 然后 点击 Composer-Setup.exe然后下载一个window下的composer安装软件

地址为 https://getcomposer.org/Composer-Setup.exe

下载后 点击安装 然后会选择php.ini版本 然后勾选 ,然后一路安装下去 有个长时间等待下载安装包,等待安装完成后,如果报错 就检查 PHP扩展的OpenSSL 有没有打开。

然后在cmd命令行中输入 composer 发现报错

C:UsersAdministrator>composer
PHP Fatal error:  Uncaught exception 'PharException' with message 'phar "C:ProgramDataComposerSetupincomp
oser.phar" has a broken signature' in C:ProgramDataComposerSetupincomposer.phar:23
Stack trace:
#0 C:ProgramDataComposerSetupincomposer.phar(23): Phar::mapPhar('composer.phar')
#1 {main}
  thrown in C:ProgramDataComposerSetupincomposer.phar on line 23

Fatal error: Uncaught exception 'PharException' with message 'phar "C:ProgramDataComposerSetupincomposer.
phar" has a broken signature' in C:ProgramDataComposerSetupincomposer.phar on line 23

PharException: phar "C:ProgramDataComposerSetupincomposer.phar" has a broken signature in C:ProgramData
ComposerSetupincomposer.phar on line 23

Call Stack:
    0.0015     328520   1. {main}() C:ProgramDataComposerSetupincomposer.phar:0
    0.0015     328608   2. Phar::mapPhar() C:ProgramDataComposerSetupincomposer.phar:23

然后在网上找到了解决方案是替换覆盖C:ProgramDataComposerSetupin下的composer.phar包 下载地址为 https://getcomposer.org/download/1.0.0-alpha8/composer.phar 然后下载好了直接覆盖掉C:ProgramDataComposerSetupincomposer.phar即可

然后再次输入composer

即得到

C:UsersAdministrator>composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ / __ `__ / __ / __ / ___/ _ / ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.0.0-alpha8 2014-01-06 18:39:59

Usage:
  [options] command [arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose outpu
t and 3 for debug
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.
  --profile           Display timing and memory usage information
  --working-dir    -d If specified, use the given directory as working directory.

Available commands:
  about            Short information about Composer
  archive          Create an archive of this composer package
  config           Set config options
  create-project   Create new project from a package into given directory.
  depends          Shows which packages depend on the given package
  diagnose         Diagnoses the system to identify common errors.
  dump-autoload    Dumps the autoloader
  dumpautoload     Dumps the autoloader
  global           Allows running commands in the global composer dir ($COMPOSER_HOME).
  help             Displays help for a command
  init             Creates a basic composer.json file in current directory.
  install          Installs the project dependencies from the composer.lock file if present, or falls back on
the composer.json.
  licenses         Show information about licenses of dependencies
  list             Lists commands
  require          Adds required packages to your composer.json and installs them
  run-script       Run the scripts defined in composer.json.
  search           Search for packages
  self-update      Updates composer.phar to the latest version.
  selfupdate       Updates composer.phar to the latest version.
  show             Show information about packages
  status           Show a list of locally modified packages
  update           Updates your dependencies to the latest version according to composer.json, and updates the
 composer.lock file.
  validate         Validates a composer.json

说明安装成功!

原文地址:https://www.cnblogs.com/lizhaoyao/p/5640607.html