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:\Users\Administrator>composer PHP Fatal error: Uncaught exception 'PharException' with message 'phar "C:\ProgramData\ComposerSetup\bin\comp oser.phar" has a broken signature' in C:\ProgramData\ComposerSetup\bin\composer.phar:23 Stack trace: #0 C:\ProgramData\ComposerSetup\bin\composer.phar(23): Phar::mapPhar('composer.phar') #1 {main} thrown in C:\ProgramData\ComposerSetup\bin\composer.phar on line 23 Fatal error: Uncaught exception 'PharException' with message 'phar "C:\ProgramData\ComposerSetup\bin\composer. phar" has a broken signature' in C:\ProgramData\ComposerSetup\bin\composer.phar on line 23 PharException: phar "C:\ProgramData\ComposerSetup\bin\composer.phar" has a broken signature in C:\ProgramData\ ComposerSetup\bin\composer.phar on line 23 Call Stack: 0.0015 328520 1. {main}() C:\ProgramData\ComposerSetup\bin\composer.phar:0 0.0015 328608 2. Phar::mapPhar() C:\ProgramData\ComposerSetup\bin\composer.phar:23
然后在網上找到了解決方案是替換覆蓋C:\ProgramData\ComposerSetup\bin下的composer.phar包 下載地址為 https://getcomposer.org/download/1.0.0-alpha8/composer.phar 然后下載好了直接覆蓋掉C:\ProgramData\ComposerSetup\bin\composer.phar即可
然后再次輸入composer
即得到
C:\Users\Administrator>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
說明安裝成功!