Use Composer, no matter what

Dependency management is important. It helps to save time and to be efficient. So use it.

June 1, 2017

In this post, I want to state the “obvious” about dependency management for projects with PHP. I am working a lot with WordPress and other PHP based projects where different kind of libraries or modules are needed. To manage these, you should use composer.

Why actually use a dependency management like composer? One simple answer would be: It takes responsibility from you and helps to be more efficient. Let me explain some of the biggest advantages you can gain from composer – from my point of view.

Composer lets you define a project-setting, which is useful in many ways. If you work in a team or more developers are involved in the project, you must have such a project-setup which can be defined well and shared easily. Without, well, good luck with all the problems which come along ( every team member tends to have his own setup which does not match the other’s → many conflict situations ).

Not only if you work in a team, but also alone on a small plugin or library, composer is a big help. Especially the implicated advantage of support-service features. With a composer setup, you’re able to define supported versions of frameworks or libraries you are using or developing for. Additionally: If you update a dependency to the newest version which may have breaking changes, you can easily reverse the update and tell that you don’t support that version yet.

With composer, you not only get a tool for including other dependencies, but also provide your own project as a dependency. You are using probably Git, Subversion, or a similar VCS – so you are already good to go. With a little effort, your project is ready to `composer require`. Also, if you are not using a VCS or want to provide another way, composer is here to help and provides other protocols and methods.

I hope I could state the advantages in the above examples and there are many more, but these are the most important for me. There are disadvantages or problems by using composer you say? Probably. But they “don’t” matter. Why? Because the advantages are just stronger.

Thank you for reading and I also hope that you can take something away from it.

Btw, some useful links related to composer: