DEV Community

Discussion on: You don’t necessarily need Composer

Collapse
 
andreidascalu profile image
Andrei Dascalu

Well, like you said, composer is a package manager. Auto loading isn't it's primary purpose, it's more of an UX kind of candy (where the users are developers). When you say maybe you don't need composer, what is the scope of the statement? You have a different way of replacing package management?
In which context would you not need composer? Well, if you don't have dependencies and all you need is auto load, then this definitely fits the bill.
I would go farther and say: don't use composer if all you need is auto load. If you don't need external packages you are better off writing your own. Composer comes with bits of overhead and bits of restrictions ( you can restrict auto load compatibility to various PSR standards but your own has ultimate flexibility and it's trivial to write a small auto load function and provide a hook for "manual" loading classes they may not respect a standard)

Collapse
 
thinkverse profile image
Kim Hallberg

I completely agree with the statement "If you don't have dependencies and all you need is auto load". That is what this post is meant to demonstrate. I've seen many projects that don't use any external packages use Composer just for their autoloading - which I can admit I've done myself before.

After reading a bit on autoloading though, I found out that implementing simple autoloading wasn't that difficult thing to do, hence this post. I can admit though the title was a cheeky attempt to be a bit provocative. And yes, Composer does more than just autoloading, it's a package manager after all. But as I state in the post - "If your project already requires packages from other sources via Composer, then it's best to stick with Composer...". This post is all about implementing simple autoloading after all, not package management.

Collapse
 
alnahian2003 profile image
Al Nahian

Isn't composer a Dependency Manager?