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
requireorincludeautomatically. 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_registerwill 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_registerallows multiple functions of autoload, already__autoloadis limited to one. Another very important difference is that__autoloadis deprecated in PHP 7.2+ 4) Is the functionspl_autoload_registerthat the Composer uses for class loading.– Valdeir Psr