2
What would be the Autoloading of PHP Classes?
I see people using __autoload
and spl_autoload_register
there is a difference?
What association exists between the autoloader of commiserate and the self-loading conventional?
Are these two functions being used under the cloths in the autoloader of commiserate?
1) Autoloading Classes is checking, loading a particular file on your system. It’s as if you’ve been using
require
orinclude
automatically. Avoiding all that code with numerousrequire
. The self-loading also prevents you from loading files without need. This is because when you are, in fact, using them, the function you set inspl_autoload_register
will do so at the right time, without prejudice to the system.– Valdeir Psr
2) Yes, there are differences between them. The main one is that
spl_autoload_register
allows multiple functions of autoload, already__autoload
is limited to one. Another very important difference is that__autoload
is deprecated in PHP 7.2+ 4) Is the functionspl_autoload_register
that the Composer uses for class loading.– Valdeir Psr