Skip to main content

Create a Module

On this page

n2n has a modular structure. In this chapter we show you how you can create your own n2n modules. To create a module you only have to create the required directories.

Required Directories​

To create a module you have to create a new subdirectory in the app directory. The name of the folder is the namespace of the module. So that it is recognized by n2n, you have to create a subfolder with the name of the namespace in the var/etc directory. With the creation of this subfolder the module is installed. Furthermore we recommend creating a subfolder with the namespace under public/assets/ as well. Here all images, JS and CSS files that your module needs can be stored.

In summary, the following folders are required to create a module:

  • app/[module-namespace]
  • var/etc/[module-namespace]
  • public/assets/[module-namespace] (optional, but recommended)

n2n works with namespaces. Therefore the developer is free to choose the structure within his module directory. In principle we recommend the following subfolders:

  • /bo for business objects
  • /controller for all controllers
  • /model for all models
  • /view for all views

It is possible without problems to create additional folders. For large modules we recommend creating subdirectories within the directories mentioned above, which improve the clarity.