This article mainly introduces the PHP dependency package Composer installation, has a certain reference value, now share to everyone, the need for friends can refer to
1. Configure the PHP environment variable (no other information will be consulted)
2. Use the Open command line in the project root directory
3, the command line to perform the operation
Php-r "Copy (' Https://getcomposer.org/installer ', ' composer-setup.php ');" Php-r "if (Hash_file (' SHA384 ', ' composer-setup.php ') = = =" 544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061 ') {echo ' Installer verified '; } else {echo ' Installer corrupt '; unlink (' composer-setup.php ');} echo php_eol; " PHP composer-setup.phpphp-r "unlink (' composer-setup.php ');"
which
544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061
A string that is a version numbering class
4. Implementation
PHP Composer.phar
The command list will appear when the installation succeeds
5, in the project to use Composer, need a composer.json file, the format is as follows (the specific values to see the situation):
{ "name": "Topthink/think", "description": "The new thinkphp framework", "type": "Project", " Keywords ": [ " Framework ", " thinkphp ", " ORM " ], " homepage ":" http://thinkphp.cn/", " License ":" Apache-2.0 ", " authors ": [ { " name ":" liu21st ", " email ":" Liu21st@gmail.com " } ], "require": { "php": ">=5.4.0", "topthink/framework": "5.0.*", "topthink/ Think-image ":" ^1.0 ", " Topthink/think-captcha ":" 1.* ", " Topthink/think-mongo ":" 1.* ", " topthink/ Think-migration ":" 1.* ", " Topthink/think-queue ":" 1.* ", " Topthink/think-helper ":" 1.* " }, " AutoLoad ": { " psr-4 ": { " app\\ ":" Application " } }, " Extra ": { " Think-path ":" Thinkphp " }, " config ": { " Preferred-install ":" Dist "} }
6. Implementation
PHP Composer.phar Install
7, if the project has already had composer.json , the composer.lock implementation
PHP Composer.phar Update