A Single Location for Classes

Before we implement a PSR-0 autoloader, we need to pick a directory location in the codebase to hold every class that will ever be used in the codebase. Some projects already have such a location; it may be called includes, classes, src, lib or something similar.

If a location like that already exists, examine it carefully. Does it have only class files in it, or is it a combination of class files and other kinds of files? If it has anything besides class files in it, or if no such location exists, create a new directory location and call it classes (or some other properly descriptive name).

This directory will be the central location for all classes used throughout the project. Later, we will begin moving classes from ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.