Composer is a tool used in PHP to manage dependencies. You can declare the dependent external library (libraries) in your project. Composer will help you install these dependent library files.
Composer is a tool used in PHP to manage dependencies. You can declare the dependent external library (libraries) in your project. Composer will help you install these dependent library files.
Install PHP Composer
System Requirements:
Composer needs PHP5.3.2 + and above to run. Several sensitive PHP settings and compilation flags are also required, but the installer issues a warning when there is any incompatibility.
For example, PHP extension requires that php without-disable-phar be installed or re-compiled.
To install a software package from the source address, instead of simply compressing the file package, you will need to install the software package's version control tools, such as git, svn, or hg.
Composer is compatible with multiple platforms and runs on Windows, Linux, and OSX.
Error message of installation failure:
Curl-sS https://getcomposer.org/installer | PHP #! /Usr/bin/env php some settings on your machine make Composer unable to work properly. make sure that you fix the issues listed below and run this script again: The phar extension is missing. install it or recompile php without-disable-pharYour PHP (5.2.9) is too old, you must upgrade to PHP 5.3.2 or higher.
My local development environment is PHP 5.2.9 by default. When I try to install it on PHP 5.2.9, the system prompts that the version is too low and needs to be upgraded to PHP 5.3.2 or later.
So I downloaded XAMPP 1.7.7 usb lite.
E: \ USB \ Dropbox \ phpstorm \ php53> E: \ USB \ xampp_177 \ php \ php.exe-v PHP 5.3.8 (cli) (built: Aug 23 2011 11:50:20) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
The PHP environment in XAMPP 1.7.7 is 5.3.8. Confirm that my PHP environment is greater than or equal to PHP5.3.2.
Install Composer in PHP 5.3
E: \ USB \ Dropbox \ phpstorm \ php53> curl-sS https://getcomposer.org/installer | E: \ USB \ xampp_177 \ php \ php.exe #! /Usr/bin/env php Some settings on your machine may cause stability issues with Composer. if you encounter issues, try to change the following: The openssl extension is missing, which will reduce the security and stability o f Composer. if possible you shoshould enable it or recompile php with-opensslDownloading... Composer successfully installed to: E: \ USB \ Dropbox \ phpstorm \ php53 \ composer. phar Use it: php composer. phar
Note:
I disabled the SSL module of XAMPP 1.7.7 Apache, so Composer prompts me to warn me that I should enable the SSL module for security reasons. It is not enabled or affected.
Parameter during installation | PHP, which must be changed to the actual PHP environment path, for example, | E: \ USB \ xampp_177 \ php \ php.exe
Use Composer as the PHP path + command. In our installation environment, use the E: \ USB \ xampp_177 \ php/php.exe composer. phar command.
The environment I installed is in Windows. If it is in Linux and the PHP 5.3 environment is not in the default PHP Command, |/usr/php/53/usr/bin/php should be used, for example:
Https://getcomposer.org/installer |/usr/php/53/usr/bin/php
After the installation is complete, check the installation version.
E: \ USB \ Dropbox \ phpstorm \ php53> E: \ USB \ xampp_177 \ php/php.exe composer. phar-V Composer version 0209bd31a0ac3aeb2a68fc81e2d03c71072bef33
Check the PHP Composer command:
E: \ USB \ Dropbox \ phpstorm \ php53> E: \ USB \ xampp_177 \ php/php.exe composer. phar ______/____/_______________________________///__\/__'__\/__\/__\/___/_\/___ ///___//_////////_///_/(__) __//\____/\____/_//_//_/. ___/\____/____/\___/_ // _/Composer version 0209bd31a0ac3aeb2a68fc81e2d03c71072bef33Usage: [options] command [arguments] Options:-help-h Display this help message. -quiet-q Do not output any message. -verbose-v Increase verbosity of messages. -version-V Display this application version. -ansiForce ANSI output. -no-ansiDisable ANSI output. -no-interaction-n Do not ask any interactive question. -profileDisplay timing and memory usage information-working-dir-d If specified, use the given directory as working directory. available commands: aboutShort information about Composer archiveCreate an archive of this composer package configSet config options create-project Create new project from a package into given directory. dependsShows which packages depend on the given package diagnoseDiagnoses the system to identify common errors. dump-autoload Dumps the autoloader dumpautoload Dumps the autoloader helpDisplays help for a command initCreates a basic composer. json file in current directory. installinstallthe project dependencies from the composer. lock file if present, or falls back on the composer. json. listLists commands requireAdds required packages to your composer. json and INSTALLThe m run-script Run the scripts defined in composer. json. searchSearch for packages self-update Updates composer. phar to the latest version. selfupdate Updates composer. phar to the latest version. showShow information about packages statusShow a list of locally modified packages updateUpdates your dependencies to the latest version according to composer. json, and updates the composer. lock file. validateValidates a composer. json
In this way, we have installed the Composer in the PHP5.3 environment.
You can install PHP 5.4 in a similar way.
Install Composer in PHP 5.4
Download XAMPP 1.8.1 usb lite to get the PHP5.4.7 environment.
E: \ USB \ Dropbox \ phpstorm \ php53> E: \ USB \ xampp_181 \ php \ php.exe-v PHP 5.4.7 (cli) (built: Sep 12 2012 23:48:31) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
After confirming that the version is later than PHP 5.3.2, start the installation: