Some legacy applications may already have a custom autoloader in place. If this is our situation, we have some options:
Use the existing autoloader as-is: This is our best option if there is already a central directory location for the application class files.
Modify the existing autoloader to add PSR-0 behavior: This is a good option if the autoloader does not conform to PSR-0 recommendations.
Register the PSR-0 autoloader described in this chapter with SPL in addition to the existing autoloader. This is another good option when the existing autoloader does not conform to PSR-0 recommendations.
Other legacy codebases may have a third-party autoloader in place, such as Composer. If Composer is present, we can obtain its autoloader instance and add our central class directory location for autoloading like so:
1 <?php 2 // get the registered Composer autoloader instance from the vendor/ 3 // subdirectory 4 $loader = require '/path/to/app...