Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Is it a good thing to use composer instead of the built-in Autoloader

As i said in title, is it a good idea to don't use the built-in autoloader and to use composer instead for loading models and controllers ?

Does it imply performances fallout ?



82.2k
Accepted
answer
edited May '16

Actually, an auto-loader (the process of trying to realize which path is a class name located at) does not represent a major impact in performance, you can freely use the one provided by composer without decrease the performance. The bootleneck here is read files or read a large amount of files, because read files from the filesystem is expensive, in that case, you can improve the performance by using a opcode cache such as APC or ZendOptimzer.

Also, take into consideration that there are strategies to autoload files that are more performance friendly than others,

For example, in Phalcon\Loader, the directories strategy (more unnecessary stats) is the slower one compared with the namespaces strategy (less stats), the class-map based autoloading is the faster but is less flexible. You can see a detailed explanation of that in the docs: http://docs.phalconphp.com/en/latest/reference/loader.html