The following tutorial column by composer uses will introduce to you the difference between composer install and composer update. I hope it will be helpful to friends in need!
1.composer install
install command reads the composer.json file from the current directory and processes it dependencies and install them into the vendor directory.
php composer.phar install
If there is a composer.lock file in the current directory, it will read the dependency version from this file instead of based on the composer.json file. Get dependencies. This ensures that every consumer of the library gets the same dependency version.
If there is no composer.lock file, composer will create it after handling the dependencies.
2.composer update
In order to obtain the latest version of dependencies and upgrade the composer.lock file, you should use the update command.
php composer.phar update
This will resolve all dependencies of the project and write the exact version number to composer.lock.
If you just want to update a few packages, you can list them individually like this:
php composer.phar update vendor/package vendor/package2
You can also use wildcards for batch updates:
php composer.phar update vendor/*
Difference:
composer install command (mainly) is used in production environment. The composer.lock file records the current version information of the project. When the install command is executed, the difference between each extended
version of the lock file and the latest version will be detected. If there is any Then update to the latest version. The composer update command will also perform the above, but if you add the library to the require field in the composer.json file,
you must use the composer update command. But at this time, the contents of other libraries will be updated. At this time, if you only add a certain library without updating other libraries (such as the production environment), you must use the composer
require "Package name: version number" command. composer init --require=package name:version number -n can also automatically update the composer.json file.
To ensure safety
In the production environment you should only use composer require "package name: version number"
The above is the detailed content of The difference between composer install and composer update. For more information, please follow other related articles on the PHP Chinese website!

I'm having a tricky problem when developing a front-end project: I need to manually add a browser prefix to the CSS properties to ensure compatibility. This is not only time consuming, but also error-prone. After some exploration, I discovered the padaliyajay/php-autoprefixer library, which easily solved my troubles with Composer.

When doing big data analysis, I encountered a common but difficult problem: how to interact with the ClickHouse database efficiently. Traditional database connection and query methods cannot meet the needs of high concurrency and large data volumes, resulting in slow response and even crashes of the program. After some exploration, I found the powerful PHP library of smi2/phpclickhouse, which greatly improved my data processing efficiency.

I encountered a tricky problem when developing a multi-device-compatible website: how to accurately identify the user's browser and device information. After trying multiple methods, I found that directly parsing user-agent strings (User-Agent) are both complex and unreliable, and often misjudgments occur. Fortunately, I successfully solved this problem by installing the WhichBrowser/Parser library using Composer.

In the process of developing a website, improving page loading has always been one of my top priorities. Once, I tried using the Miniify library to compress and merge CSS and JavaScript files in order to improve the performance of the website. However, I encountered many problems and challenges during use, which eventually made me realize that Miniify may no longer be the best choice. Below I will share my experience and how to install and use Minify through Composer.

When testing web applications, you often encounter compatibility issues between different browsers. My project works fine on Chrome, but with all kinds of problems on Firefox and Safari. To solve this problem, I found the library friends-of-behat/mink, which provides me with an efficient cross-browser testing solution.

When developing Magento2 extensions, I encountered a common problem: how to ensure that the code quality meets Magento's standards. This not only affects the maintainability of the code, but also affects the overall stability and performance of the project. After some exploration, I found the magento/magento-coding-standard library, which specifically provides PHPCodeSniffer rules for Magento2 projects to help developers quickly check and optimize code.

I encountered a tricky problem when developing a project that requires JWT (JSONWebToken) certification: how to implement RSA signature algorithm safely and efficiently in JWT. Although I have some understanding of JWT, I am confused about the specific implementation of the RSA signature algorithm. After some exploration, I found the web-token/jwt-signature-algorithm-rsa library, which gave me the perfect solution.

During the development process, we often need to perform syntax checks on PHP code to ensure the correctness and maintainability of the code. However, when the project is large, the single-threaded syntax checking process can become very slow. Recently, I encountered this problem in my project. After trying multiple methods, I finally found the library overtrue/phplint, which greatly improves the speed of code inspection through parallel processing.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6
Visual web development tools