Home > Development Tools > composer > How to update thinkphp version through composer

How to update thinkphp version through composer

藏色散人
Release: 2019-12-30 15:59:27
forward
4482 people have browsed it

The following tutorial column from composer will introduce to you how to update the thinkphp version through composer. I hope it will be helpful to friends in need!

How to update thinkphp version through composer

Process

Upgrade tp5.1.19 to tp5.1.26.

Enter the project root directory, enter composer update and expect to update to the latest version, but it prompts that nothing has been updated... I tried to clear the cache composer clear-cache, but it still doesn't work. I saw a prompt from the official website that there was a problem with the phpcomposer image recently. I remembered that I had switched to the Chinese image before, so I switched back to the root image

composer config -g repo.packagist composer https://packagist.org
Copy after login

. After clearing the cache, I entered composer update and the update was successful.

Understanding & Explanation

The role of caching: I downloaded a version of a package and downloaded it repeatedly in a short period of time (updating in another project or creating a new project), it will It is much faster because it is fetched from the local cache rather than downloaded from the package repository.

Composer update package default version: Take the topthink/framework package as an example, do not add a specified version number after composer update or composer create-project, download the version seen here, that is, search for topthink from the PHP package warehouse /framework, click to see the version.

tp manual prompts composer to install the latest stable version. If you want to install the latest real-time version, enter

composer create-project topthink/think=5.1.x-dev tp5
Copy after login

. Note that the x here does not ask you to fill in the latest version or the expected version, but 5.1. .x-dev is a version of this package, representing the latest version of 5.1. If you want to download a specific version, you should go to the package repository.

Note: Some package versions have v in front of them, such as v5.1.26, while some packages do not, directly 5.1.26. The details of the package in the package warehouse shall prevail. If there is a v and you forget to enter v, you will be prompted that this version is not available...

composer command

Global switch mirror

composer config -g 镜像
Copy after login

View composer settings

composer config -l
Copy after login

Clear cache

composer clear-cache
Copy after login

Update composer

composer self-update
Copy after login

For more composer-related technical articles, please visit the composer column: https:// www.php.cn/tool/composer/

The above is the detailed content of How to update thinkphp version through composer. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template