Martin Hujer has written up a guide for the Composer users out there (you do use Composer, right?) sharing seventeen tips for using it effectively to manage the dependencies in your applications.
Although most PHP developers know how to use Composer, not all of them are using it efficiently or in a best possible way. So I decided to summarize things which are important for my everyday workflow.
The philosophy of most of the tips is "Play it safe", which means that if there are more ways how to handle something, I would use the approach which is least error-prone.
His tips include:
- Be aware of differences between a "project" and a "library"
- Use version ranges for libraries dependencies
- Run Travis CI builds with different versions of dependencies
- Do not attempt to merge composer.lock when rebasing or merging
- Update dependencies safely
- You can define other types of dependencies in composer.json
Each item in the list comes with a summary and an example of the configuration related to the tip. Most of them are small tweaks to the configuration you're probably already using but there are definitely some nice "hidden gems" in there.