Home  >  Article  >  php教程  >  I haven't done anything about Composer for a long time. . . , composer hands-on...

I haven't done anything about Composer for a long time. . . , composer hands-on...

WBOY
WBOYOriginal
2016-07-06 14:25:281024browse

About Composer - I haven’t used it for a long time. . . , composer takes action..

The first “blood” in June

Reading a book, I found that I like to read from the end, and then in PHP Classic Examples, the last chapter is about PEAR content. I checked on Zhihu and found that it’s over and out of date. It’s all about Composer, so let’s learn it

1. What

One sentence: Dependency management tool;

Explanation: It is convenient for you to download libraries, packages, etc., basically exclusive to PHP;

http://baike.baidu.com/link?url=Ql801yyOyi3P-8KVDTNst2eg2nq797pJQBrTB8GFZ6ga2gc68LKhIewpOk_D8BrrnACIM83yH6oxrXlNGVWJ8a

In addition, dependency management is just a name, but it seems to have a profound meaning: look at this http://www.infoq.com/cn/news/2011/05/ci-dependency-management/#anch68966

2. Installation

http://www.phpcomposer.com/

According to this, just install your own system and do it. What you need to know is that this thing is implemented on the command line;

My wamp has .exe directly, and then after installation find the composer.phar file for backup ;

3. Use

It is recommended to read the introduction of a Yii framework tool on imooc: http://www.imooc.com/learn/520

The key point is how to use: cd to the project file/create the project folder, and then .phar file path/composer.phar install yiisoft/yii 1.0.2

You have to study other in-depth information yourself.

A few common situations: problems that arise when you need to install the jquery package. Go to the corresponding package download page to find support: such as yii2

In addition, when you need a token for Github’s API, just go to Github to generate one and copy it over once;

In addition, each interruption will cause the file transfer to fail. Please delete the previous file before executing the command again;

In addition, it is best to match the Chinese image first to speed up, otherwise you will know the external network. . . For specific information, packagist Chinese website has it: http://www.phpcomposer.com/

The configuration is here, one command is all it takes, I like this sour feeling: http://pkg.phpcomposer.com/

<code class="language-bash hljs">composer config -g repo.packagist composer https://packagist.phpcomposer.com</code>

Screenshot of the last process:

The above, but I’ve been really lazy lately. . .

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