In Laravel, if there are multiple developers at the same time, how can we update the package?

Source: Internet
Author: User
Tags composer install
Yes. If one of them adds a dependency and registers it to the Provider. When other people update the code, an error occurs when executing composerupdate. I used to think about adding vendor to git. However, some packages in development do not need to be placed in the production environment. I would like to ask... yes. If one of them adds a dependency and registers it to the Provider. When other people update the code, an error occurs when executing composer update.
I used to think about adding vendor to git. However, some packages in development do not need to be placed in the production environment.
I would like to ask you how to solve this problem.

--- Update ---
This is the problem I encountered.
Assume that two developers have completed project initialization. Now developer A adds dependency locally:
composer require vendor/package
This package is a Laravel extension and you need to register a ServiceProvider. Therefore, developer A needs to add this Provider in config/app. php. Then there is a series of subsequent configuration blabla ~. OK. Now A can submit the code and push it to the remote branch.
Then the developer C (don't ask where B goes) has the code under pull. Now he finds a lack of dependency when executing the code. Now he needs to add this dependency.
My current method is to execute
composer update vendor/package
Because Laravel registers several hooks in composer. json, one of them will be executed during the update. During initialization, this command loads ServiceProvider, but the Provider added by A in the Code does not exist in the dependency. So composer throws an exception and exits.
This is my problem. What do you do?

Reply content:

Yes. If one of them adds a dependency and registers it to the Provider. When other people update the code, an error occurs when executing composer update.
I used to think about adding vendor to git. However, some packages in development do not need to be placed in the production environment.
I would like to ask you how to solve this problem.

--- Update ---
This is the problem I encountered.
Assume that two developers have completed project initialization. Now developer A adds dependency locally:
composer require vendor/package
This package is a Laravel extension and you need to register a ServiceProvider. Therefore, developer A needs to add this Provider in config/app. php. Then there is a series of subsequent configuration blabla ~. OK. Now A can submit the code and push it to the remote branch.
Then the developer C (don't ask where B goes) has the code under pull. Now he finds a lack of dependency when executing the code. Now he needs to add this dependency.
My current method is to execute
composer update vendor/package
Because Laravel registers several hooks in composer. json, one of them will be executed during the update. During initialization, this command loads ServiceProvider, but the Provider added by A in the Code does not exist in the dependency. So composer throws an exception and exits.
This is my problem. What do you do?

1. Someone alreadyrequirePackage to prove that the configuration is already incomposer.jsonFile, for you, you pull the code, just need composer install That's all you need.updateOf

2. In another case, to avoid the problem, there are more than one developer. It is best to determine who is the leader and who can decide what to do.

First, the new package should be placed in composer. json, and then only the file will be uploaded to git. Other members can update the composer. json file at any time.

Second, if some packages are only in the development environment rather than the online environment, you can place the required packages:

"Require-dev": {"codeception/codeception ": "1.6.0.3"} // only install the service package required by the development environment so that you can keep abreast of different service packages under different environments. composer install -- dev

You should executecomposer updateOtherwise, others do not know what the problem is!

Add composer. json to git Version Control
The vendor package is not a problem ..

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.