First, we will consolidate all the application classes to our central directory location as determined in the previous chapter. Doing so will put them where our autoloader can find them. Here is the general process we will follow:
Find an
include
statement that pulls in a class definition file.Move that class definition file to our central class directory location, making sure that it is placed in a sub-path matching the PSR-0 rules.
In the original file and in all other files in the codebase where an
include
pulls in that class definition, remove thatinclude
statement.Spot check to make sure that all the files now autoload that class by browsing to them or otherwise running them.
Commit, push, and notify QA.
Repeat until there are no more
include
calls that pull in class definitions.
For our examples, we will assume we have a legacy application with this partial file system layout:
/path/to/app/
classes/ # our central class directory location Mlaphp/ Autoloader...