Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKonstantinos Pedarakis
21,301 PointsWhen do we use composer?
Ok guys! now im stuck in here, trying to figure out what composer is. after treehouse videos and an extend search, i figured out that is a dependency manager(as title says) that controls your libraries etc. Then i had to know what the mean by libraries. i found that librairies col]uld me the jquery that you are using or the ajax for some requests etc. Now, im again in a tough position. i want to know when do we use composer? i mean the only things that i have used during my projects, were some jquery, some css database stores and thats about it. how do i know beforehand which lets say libraries i would use in the future as i develop my app? thanks in advance guys, realy desperate here! :(
4 Answers
Kevin Korte
28,149 PointsHi Konstantinos,
So the site Packagist lets you search for packages that can be pulled in by composer. In short, on a small project, Composer could be overkill.
It's really designed to make working on a dev team easier. With composer, you can specify all the dependencies your project requires, and the version number. So now if you bring another dev on board, you can give him that package.json file, and they can use composer on their local machine to install the exact same packages and versions of packages needed.
When you're on a one person project, it doesn't provide much benefit, as it's just you, but it can be good to get in the habit of using composer.
thomascawthorn
22,986 PointsI can't imagine starting a project without composer - even small projects - because of the benefits for both individual teams of developers. I wouldn't use it for projects that have no chance of going live (in other words, if you're just playing around).
Version control, for example, is something that'd be silly to manage without composer. Even in the smallest of projects, it's likely you'll be pulling in bits of, for example, Symfony or using a micro framework such as Slim.
My vote goes to using composer as much as possible, even when working alone. It's time saving and a common tool for php developers - so very good to know, and know well.
Aamnah Akram
17,549 PointsI'm new to composer myself. My understanding is that when you start working on a large project, managing the dependencies gets cumbersome along the way. Say your project uses jQuery.. Now the manual way is going to the website, downloading the files, copying them to the project and then linking to them. On the other hand, with Composer it's as simple as running two or three commands? Now, some time passes, a newer version of jQuery is released and you want to update your project to use that newer version.. If you do it manually, you go to the jQuery site again, download the files again, overwrite existing files in your project and update the links. Takes a few minutes, doesn't it? With composer, you just open a file and change a version number. Simple, and saved you a few minutes.
I see composer as something that'll save me a few minutes every now and then..
Ted Sumner
Courses Plus Student 17,967 PointsI agree with Tom Cawthorn regarding using composer as much as possible. The size of the project does not make any difference to me. I want to use best practices and save time. Compose allows me to do that.
With respect to Packagist, however, I have the hardest time finding stuff that I think is relevant to me and I can use organically. Most are aimed at a framework of some sort. I would love a tutorial on that.
Konstantinos Pedarakis
21,301 PointsKonstantinos Pedarakis
21,301 Pointsthanks both of you guys for the responses. i'm trying really hard here! :) composer is something new to me yet, but i wish i could say what Tom Cawthorn said, that "i can't imagine starting a project without composer", one day! So, just to clear something. If im working to a project using composer and having the Slim microframework and want another dev to join to my project , so we can work together, if i give him my files as they are, you saying that he cant really work with the files as they are right? he need to use composer, to install whatever i had install to build the app, up to that point right?