top of page

"What is composer? I know it is for PHP and it is a "dependcy/package manager", but what does that really mean? What would I use it for?" In the simplest terms, composer is a program that can download and install stuff. Composer is written in PHP, and runs as a php script, so you need to have PHP installed in order to run composer.

"Wait, didn't you just say it was a program? Now your saying it is a PHP script?" Well that is the point of a script right? They provide instructions for the computer to run, just like a program does.

"Ok, I get your point. But isn't that a copout? Running a script through PHP is less convenient than just running a program." Not necessarily. It is possible to setup composer such that you can run it from the terminal just by entering composer

"I see, that does make it look and feel like I'm running a program. But you say it can download and install stuff, that sounds really generic... What is the main use case?" Typically people use it to download PHP libraries their project depends on. But it can also be used to install tools. For example, I use it to install Psysh such that I can use it with any project on my system. Basically you can "download and install stuff" locally for a specific project, or globally for your user such that you can use it anywhere on your system.

"But if people mostly use composer to download PHP libraries... can't I just download the files manually? I don't want to learn another tool." That is perfectly valid, and there is nothing wrong with doing that. But composer also makes it easy to update to the latest version of a library. It is also nice that you have a single composer.json file that shows all the dependencies for your project. Composer has many other features that makes it useful as a dependency manager for your PHP projects.

​

composer self-update

​

Makes composer update itself. My, how convenient! Don't use sudo... unless you need to. But you shouldn't need to. If you do need to, that probably indicates some kind of problem.

​

composer global update

​

Updates ALL your globally installed things! The convenience is unbearable.

​

bottom of page