What is "php-autoload"

The autoload function is used in PHP to automatically load classes.

Whenever we want to create an object, we must have the class responsible for creating the object loaded in memory, otherwise PHP will return an error. To load classes into memory we can load all classes at the beginning of the document using the command include_once or with the same command immediately before instantiating an object.

The autoload function is used in PHP to automatically load the classes, the big problem is that include_once loads the classes in memory even if you don’t use them. Often a class is only used if the user makes a request on the system, a certain step, or if the user clicks on a button, etc. To resolve and simplify such a procedure PHP provides the "auto load" function, which is the autoload function, which loads the class only when an object of this class is created, making the process of loading the classes to dynamic memory.