user2521436
user2521436

Reputation: 299

ZF2 Composer autoloading or via Zend\Loader whats the difference?

at the moment i going to learn ZF2.

I want to test ZF2 without MVC to understand the components.

Now my first Question.

There are different Types of Zend\Loaders and Composer.

Should i use composer to autoload my classes, third party librarys, e.g or the Zend\Loader* ?

Why there are Zend\Loaders like the StandardAutoloader if we have composer?

Upvotes: 0

Views: 109

Answers (1)

AlexP
AlexP

Reputation: 9857

They do the same thing, which is obviously autoload classes, although it might be an unfair comparison. The Zend implementation is simply a collection of classes that wrap the SPL auto loader.

Composer however, is a package manager and manages the entire application library. This includes sourcing and updating third party resources according to custom specifications (composer.json), perhaps pulling from GitHub or informing you of other missing dependencies.

The icing on the cake is that composer once compleate with all that hard work, automatically generates a custom autoloader class including all the managed namespaces just for you. This class can be rebuilt over with one command composer update as your projects requirements change.

Upvotes: 1

Related Questions