1. Download and install composer
The following takes Windows as an example. Please refer to the official manual for Linux and other operating systems:
(1) Visit the official website address: https://getcomposer.org/download/, click Composer-Setup.exe Download, as shown in the figure
(2) After the download is completed, double-click to run to install, directly Click next until the installation is completed. (Note that you need to select the PHP version here, mine is PHP7.2)
## (3) After the installation is completed, we can enter the composer -v command through the command window (cmd) to check whether the installation is successful. If the following interface appears, it means the installation is successful:
##(4) Next we can change Packagist is the domestic image (the Alibaba Cloud image is used here), the execution command is as follows:
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ |
(5) If you need to cancel the use of the image, execute the following command:
composer config -g --unset repos.packagist
|
2. Download Think.
(1) Visit topthink/think official website: https://packagist.org/packages/topthink/think.
##(2) Choose the version you need, here we take 5.1.36 as an example, Select and click to enter:
(3) Copy the composer create-project topthink/think command. Open the cmd window and enter the www directory. My root directory is under D:\phpStudy\PHPTutorial\ and execute the following statement:
Think=5.1.36 is the thinkphp version, and tp5.1.36 is the project name.
(4) Press the Enter key and wait for a while. You will see that the tp5..1.36 project has been automatically downloaded and created in this directory. The www folder under the D drive is as follows:
## This will download the thinkPHP5.1 project.
3. Use phpstudy to deploy and run the project and run it in the browser.
Enter http://localhost:8010/tp5.1.36/public/, in the browser If the page shown below appears, the deployment and operation are successful.
Where:
localhost is the local host name, it can also be 127.0.0.1 or the local host IP address;
8010 is the port number of the apache server, the default is 80, I modified it here to establish 8010;
tp5.1.36 is Project name;
public is the public entrance to the project.
In this way, we have created the tp5.1 project.
The above is the detailed content of Create TP5.1 project using composer. For more information, please follow other related articles on the PHP Chinese website!
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