The classloader is provided by ownCloud and loads all your classes automatically. The only thing left to include by yourself are 3rdparty libraries. Those should be loaded in appinfo/application.php.

The classloader works like this:

  • Take the full qualifier of a class:

  • If it starts with \OCA include file from the apps directory

  • Cut off \OCA:

  • Convert all charactes to lowercase:

  • Replace \ with /:

  • Append .php:

  • Prepend /apps because of the OCA namespace and include the file:

    require_once '/apps/myapp/controller/pagecontroller.php';

In other words: In order for the PageController class to be autoloaded, the class \OCA\MyApp\Controller\PageController needs to be stored in the /apps/myapp/controller/pagecontroller.php

All documentation licensed under the Creative Commons Attribution 3.0 Unported license.