Namespaces & Class Names


The following is a list of recommended namespaces for various classes when developing within the Contao framework. None of these are mandatory though.

Namespace Resource
App\ContaoManager Contao Manager related classes (e.g. the Manager Plugin)
App\Controller\ContentElement Content element fragment controllers
App\Controller\FrontendModule Front end module fragment controllres
App\Cron Cron jobs
App\EventListener Symfony event listeners, Contao hooks & callbacks
App\Model Database models
App\Widget Form widgets

Class Names

As it is customary within the Symfony environment, classes of certain namespaces should also be named with a namespace specific suffix:

Namespace Suffix Example
App\Controller Controller App\Controller\ExampleController
App\Cron Cron App\Cron\ExampleCron
App\EventListener Listener App\EventListener\ExampleListener
App\Model Model App\Model\ExampleModel