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 alreadyrequire
Package to prove that the configuration is already incomposer.json
File, for you, you pull the code, just need composer install
That's all you need.update
Of
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 update
Otherwise, others do not know what the problem is!
Add composer. json to git Version Control
The vendor package is not a problem ..