Home >Backend Development >PHP Tutorial >composer dependency management tool

composer dependency management tool

WBOY
WBOYOriginal
2016-07-28 08:27:12997browse

Composer is PHP A dependency management tool,It is managed on a per-project basis and installed in a certain directory of your project (such as vendor).

By default it will not install anything globally. So this is just a dependency management.

Composer will solve the problem for you like this:

a) You have a project that depends on several libraries.

b) Some of these libraries depend on other libraries.

c) You declare what you rely on.

d) Composer will find out which versions of packages need to be installed, and install them (download them into your project).

Composer requires PHP version 5.3.2 or above.

Before installing composer, you have to make sure that PHP has been added to the system's Path environment variable. The detection method

Enter php in cmd - v

 composer依赖管理工具

If not, please copy the file directory containing php.exe to the path

composer installation. Here we only talk about the manual installation process:

1: Go to the composer official website to download the latest version of composer

https://getcomposer.org/download/

 composer依赖管理工具

After downloading, it will be a composer.phar file, then copy it to the PHP installation directory (the same directory as PHP.exe), and command The PHP executed in should be the same set of PHP, then create a new composer.bat file here, and save the following code to the file

<code>@php <span>"%~dp0composer.phar"</span> %*</code>
Finally, reopen a command line window and try to execute it

to see if the version is output correctly Number. composer --version
 composer依赖管理工具
This method corresponds to global installation and can be run with the composer command anywhere. For partial installation, you need to copy composer.phar to the place where you want to run it and run it through php composer.phar.

composer’s official website is in English. If readers are not used to reading, I recommend two websites:

http://docs.phpcomposer.com/00-intro.html

http://pkg.phpcomposer.com /




The above has introduced the composer dependency management tool, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn