Common Questions

What If I Already Have An Autoloader?

Some legacy applications may already have a custom autoloader in place. If this is our situation, we have some options:

  1. Use the existing autoloader as-is: This is our best option if there is already a central directory location for the application class files.
  2. Modify the existing autoloader to add PSR-0 behavior: This is a good option if the autoloader does not conform to PSR-0 recommendations.
  3. 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 ...

Get Modernizing Legacy Applications in PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.