11

I think there is no need to include composer for loading any library etc. Loading some libraries is not hard task. Its easy to include...

Download library > extract > put into your project > use it

This task is only one time per project. I mean its not over and over again.

Updating is not huge task too... just download and replace with old files in your project.

this is just 30 seconds for each library. I do not see any reason to include one more layer (composer) to my project.

Plus if we add this layer (composer) to our project, it brings its own problems. Check this to see how many people dealing with composer errors; https://stackoverflow.com/search?q=composer+error

I think I overlook something here. Because almost everybody use composer and recommend.

Could you tell me what I do overlook about composer? What are the benefits of it?

Community
  • 1
  • 1
thomas
  • 331
  • 2
  • 8

2 Answers2

3

Composer allows you to very easily install a multitude of software for your project without dealing with the details.

It allows the authors to use another library themselves without you having to deal with all the details.

For example, if you would want to manually install a library that requires to install two additional libraries in the correct version, with these libraries requiring one additional library each, and additionally you'd have to initialize the autoloading of all five libraries, this might be some task to tackle.

With Composer, you only require one library, and after that everything is done for you.

Additionally, it makes updating way easier for you. If your library has a bug that got fixed in a newer version, you simply update and see if your application still runs. You'd spend most of the time checking everything still runs - and barely any time updating. That's productive.

Yes, you can do it manually. But why? But I can understand that you can't see the advantage if you don't update software extensively or don't use plenty of libraries.

Sven
  • 69,403
  • 10
  • 107
  • 109
1

The nice thing about Composer is that handles downloading libraries for you all by itself. All you have to do is specify a list of the libraries you want and Composer does the rest.

These things you think are easy to do manually (updating library versions, including them in your project etc) are all done automatically by Composer. What do you think is easier for yourself and your dev team? Installing a bunch of libraries manually - or installing Composer, writing a single composer.json file and typing "php composer.phar update."

The biggest benefit of Composer is that it will automatically grab all libraries required by the library you want. Suppose you have a library A that needs B, and B needs C, and C needs D etc. Without Composer, you would have to do this yourself. And this takes time and risks error.

Let me know if you have more questions about Composer. It will save you a lot of problems in the long run.

user2910265
  • 844
  • 1
  • 9
  • 15
  • 2
    thank you for your answer. As I said, doing these task, before starting a project, is not hard task. if composer only do this task I really not understand why all php community talk about composer as it is best thing in php lately... How can it be one of the best things, even really no need it... – thomas Dec 13 '13 at 09:36
  • 2
    downloading and puting those libraries is easiest part of the project. plus, we do this just one time before begin the project. not again and again. updating them are not huge task too. just replace files. how can it be hard to do... – thomas Dec 13 '13 at 09:43
  • Yes, technically you can do everything Composer does manually but it is very susceptible to human error. There's a good chance you'll have to things Composer does many times over during the lifetime of your project + not just at the start. Are you okay with going through that for dozens of libraries and their entire chain of dependent libraries every time there is a library update, every time you switch code branches, etc? If you are then Composer is not necessary for you. – user2910265 Dec 13 '13 at 10:03
  • Yes I am really ok. Plus I do not want to include a library just a composer command. I want to test it, before include or update. Do you include a library to your project before you test it? if you test, it means you included (downloaded and placed) it to your project (no need composer anymore after you test it in your project test environment). I do not want to argue with you. I only want to understand why others talking about composer as its miracle. – thomas Dec 13 '13 at 10:15
  • I do apologize if I have sounded argumentative. I'm trying not to but it probably is coming out that way. Again, Composer is optional but if you follow the test procedure you described and find out something went wrong, I do think it's much easier to recover from an error with Composer. – user2910265 Dec 13 '13 at 10:34
  • No, thank you again for time and answers. Yes it seems like composer is optional but lately almost all library providers (and frameworks) require composer to install it. removing composer from those libraries (and frameworks) is boring task. – thomas Dec 13 '13 at 10:40