Windows installation Composer methods and how to use them

Source: Internet
Author: User
Tags log log

Recently in the Learning YII2 framework of knowledge, for Yii2 many new features, it is best to check the official website documents the best, if there is a Chinese translation of the site is better.


The first hurdle to learning Yii2 is to install composer, a dependency management tool (but for now I think it's a package manager, although the official website has its explanation). To install the second threshold of composer is to be based on the characteristics of China's scientific internet access. Therefore, when I have not started to learn yii2, there are two barriers in front of me. For the novice, estimated to quickly give up the *_*, fortunately, the official also provides another installation method, directly to the YII program package, download can be used, convenient and quick. But as a one who is interested in playing in the world, how can I because of such a two-way threshold, and give up learning new open (installed) hair (force) skills? No nonsense, the following: Install composer under Windows There are two ways: one is a fool-like installation, the other is a tall command line. Little brother I Caishuxueqian, failed to install composer in the command line, and ran to the fool-type next->next->finished mode. A URL is provided here (http://docs.phpcomposer.com/00-intro.html#Declaring-dependencies), which are installed in both ways,but all need a front (door) to mention (sill), to understand the scientific Internet.  after reading the above URL to provide the method, I would like to wait for the beginning of the installation of the steps, unfortunately, because the scientific Internet mode is not open, my first time, and therefore failed.  One, the following is the failed installation process:Download and runComposer-setup.exe, pop-up player's installation interface next step whether to pass proxy, remember not to tick oh next then is the long wait, etc., etc... Finally appeared the following hint, oh, no, there is no connection to the other people's server. The error message is as above: the "Https://getcomposer.org/download/1.0.3/composer.phar.sig" file could notbe downloaded:failed to open Stream: The connection attempt failed because the connecting party did not reply correctly after a period of time or the connected host did not respond. As a programmer who has strict requirements on himself, now think about it, where did I write it wrong? Well, no, it's someone else's program. Oh, does that have any documentation? Report, the documentation has been introduced for this situation. Huh? What did they do in the test, and it couldn't be measured? Report, which is in the celestial State, the situation may be a little special. Well, also, forget it, turn on scientific internet mode. Second, the next installation, the steps are as follows:RunComposer-setup.exe, pop-up player installation interface Next, Next, next, a housekeeper gave me a pop-up warning, on this, I just LOL, click to remember my choice, allow, and then appeared successful. OMG, finally installed successfully, yes it is,i would come. Here is the installation location and protocol key location for composer: installation location: Secret key location: So far, composer can be at ease to serve me. Third, how to use: How to view the composer under the command line is the installation successful? Under Life line type: Composer, output composer: You can see the composer flag on the command line, stating that composer was successfully installed, and to install Monolog as an example, demonstrate how composer is used: Next we're in the www/directory. , create the Cmoposer directory, and enter it on the command line: Composer require monolog/monolog, wait: If the Monolog installation succeeds above the red bezel is the dependency that is required to install Monolog. Here is the installed Monolog directory in order to verify the success of the Monolog installation, here is an official small example, as follows:
  1. <?php
  2. require_once(‘vendor/autoload.php‘);
  3. use Monolog\Logger;
  4. use Monolog\Handler\StreamHandler;
  5. // create a log channel
  6. $log =newLogger(‘name‘);
  7. $log->pushHandler(newStreamHandler(‘D:/uploads/your.log‘,Logger::WARNING));
  8. // add records to the log
  9. $log->warning(‘Foo‘);
  10. $log->error(‘Bar‘);
After success can be in the D disk under the Uploads directory, see a your.log log file, such as; attachment is I use composer installed monolog, and use case. The initial installation and use of Ok,composer has ended. Reference URL: http://docs.phpcomposer.com/Composer Chinese introductionHttps://getcomposer.org/composer official website http://blog.tanteng.me/2015/05/could-not-open-input-file-composer-phar/ Small Talk Blog https://packagist.org/PackageHttps://github.com/Seldaek/monolog Monolog's GitHub Warehouse 



From for notes (Wiz)



List of attachments

Windows installation Composer methods and how to use them

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.