Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I do not understand why someone need composer? [closed]

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?

like image 809
thomas Avatar asked Dec 13 '13 08:12

thomas


People also ask

Why do we need composer?

Composer allows developers to specify project dependencies in a composer. json file and then Composer automatically handles the rest. Composer makes it easier to keep vendor libraries out of your repo, meaning that only application code goes in the git repository.

How do I check if composer is installed?

You can check your installed composer version using a command composer -v at the current path. Such as: composer -v.


2 Answers

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.

like image 176
Sven Avatar answered Oct 18 '22 22:10

Sven


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.

like image 1
user2910265 Avatar answered Oct 18 '22 21:10

user2910265