What is "class sneaking"?

Created by Greg on on 2010-08-09
Keywords:
definition
Last updated by:
Greg on on 2010-08-09

A framework like PHPDevShell contains a lot of classes, which definitions are scattered in many php files. To avoid having to figure out where each class is defined (and to allow class overriding), PHPDevShell uses a mechanism called "autoload", which will attempt to find the files needed for a class when a class definition is required but does not exist (i.e. has not yet been included). This means that, usually, classes can simply be called by name, and the inclusion of the required files will be automatic.

The underlying process of finding out where the class is, based on its name and the site configuration, is called "class sneaking".