Detailed steps for installing composer

Composer installation tp5 tutorial
1. Download composer
First introduce several websites
Composer official website https://getcomposer.org/

Our ultimate goal is to get the composer.phar file.
No matter what method we use, as long as we get this file, the download will be successful. We will introduce the simplest one for everyone to
open the composer Chinese website http://www.phpcomposer.com/ as shown in the figure above.
Click the download button in the middle to find the picture

Just click on the latest version to download (version 1.5.2 on the way)
Note (it is best to download it to a simple path as shown in the figure below, then the folder path is E:\cs

After downloading, as shown in the figure

So far, our first stage has been completed, and we will continue to work hard

. 2. After testing the availability of composer
, we do not need to install it. We can get this file and use it directly. In the next two, we will test the usability
. This file is more troublesome for us to use. It cannot be executed directly, it must be executed through php and it must be executed through PHP in the command line, so to test usability we divide it into several steps to
first find the location of the php.exe file
My computer is using the xampp integration package I The file path is D:\az\xampp\php\php.exe
. As for your similarities, just find this file. This path must be written down because we will use
the second step to open the command window. There are many ways to open it. The simplest way is
win+R and then enter cmd and press Enter
to get this is the command window

The third step command line switches to the directory where the composer.phar file is located
(all commands in the command line must be entered in English)

Above we downloaded composer.phar to the file E:\cs,
so first switch the command to the E disk
command line and enter the specified "disk +:" and press Enter as shown in the figure below

Then jump to the specified folder through the cd command.
Just enter "cd cs" under the new drive letter (there must be a space in the middle)
as shown in the figure below, and you will be in the folder E:\cs where we downloaded composer.phar.

At this time, we only need to enter the dir command to see our composer.phar file as shown in the figure

The fourth step is to enter
the command format
D:\az\xampp\php\php.exe composer.phar -V
(note (D:\az\xampp\php\php.exe)+space+composer.phar+space- V (the last V must be a capital letter V)) -V command is to find the version of composer. There are
two spaces in the middle. Don't forget to
show the version number and date of composer.phar as shown in the figure below to prove our file. is available

At this point, our composer is installed, and then we can download tp5.

3. Download tp5
In many cases, we use composer to download third-party class libraries, but all composer's third-party class libraries are in his resources. The website means that composer downloads his class library from his resource network (if I write a class library, it can only be downloaded through composer after uploading and publishing it to the resource website)
Composer resource network https://packagist.org/
Because of this The website is a foreigner, so it will be very slow to download, so we have to use a Chinese mirror to download. We just need to do a little bit of it (actually, it is to execute a command).
This command is on the Chinese website Composer Chinese website http://www .phpcomposer.com/ open the Chinese website and click on the Chinese mirror to enter as shown in the figure

Directly copy the command in method 1
because we do not use the method of simplifying the command, so we still need to splice the command.
First find our basic command above
D:\az\xampp\php\php.exe composer.phar
and then copy the above picture The command in the Chinese mirror and remove the composer in the head (the simplified command of this value works equal to D:\az\xampp\php\php.exe composer.phar)
config -g repo.packagist composer https://packagist .phpcomposer.com The
final command we get is
D:\az\xampp\php\php.exe composer.phar config -g repo.packagist composer https://packagist.phpcomposer.com
Be sure to pay attention to the spaces as shown below and press Although there is no response after returning to the car, it is actually successful.

99% of it has been completed here, and then we just need to find the installation of tp5 in the manual of tp5

In splicing a command
D:\az\xampp\php\php.exe composer.phar create-project topthink/think tp5 --prefer-dist
as shown

After clicking enter,
wait for the last 10s as shown in the figure

It has been downloaded successfully. At this time, you can see a tp5 folder in the cs folder and we can use it.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324892406&siteId=291194637