E
E
expressrus2017-02-06 14:42:09
PHP
expressrus, 2017-02-06 14:42:09

Composer autoload how does it work?

Interested in the question does the composer load the libraries all at once or as they are actually used? I would like to save resources) there are some that I use very rarely in special. cases)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
@
@smple, 2017-02-06
@expressrus

it loads only what is required in the code
, there the loader is added via php.net/manual/ru/function.spl-autoload-register.php

M
McBernar, 2017-02-06
@McBernar

Oh :)
Composer simply downloads libraries to your project and writes them to autoload.
Autoload doesn't work like "load everything into me right now, hurry up!!!". It only works when referring to a class that is not in the current file.

A
Andrey Nikolaev, 2017-02-06
@gromdron

Exactly as prescribed by smple , but with one caveat: composer must also be included in the project, and this is already through require_once('vendor/autoload.php')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question