Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Autoloading

Aubrey Portwood edited this page Feb 2, 2019 · 2 revisions

The App's autoloader takes in a class name like:

new My_Class_Name() and converts it to e.g. my-class-name and looks for a file named class-{my-class-name}.php in app/, components/, and services/ folders. Note that the file name must be class-{my-class-name}.php to be autoloaded.

It is suggested that you also place component or service classes in a folder named with the same conversion, e.g. services/{my-class-name}/class-{my-class-name}.php for easy finding/navigation. But, as you will see, our recursive autoloader will still find it no matter what you name it.

Recursive autoloading

Let's say you have your class-my-class-name.php file in components/my-component/class-my-class-name.php a new recursive autoloading feature in 2.0.0 will still find it as if it fails to find it in a app|components|service/my-class-name/ folder as it will recursively search for it.

Clone this wiki locally