This website uses Cookies to provide you with the best possible service. Please see our Privacy Policy for more information. Click the check box below to accept cookies. Then confirm with a click on "Save".  
Status: 2025-02-06

Creating a Module


Creating a primary Module

use the following command to create the primary module Foo

php emvicy module:create Foo primary

Creating a secondary Module

use the following command to create the secondary module Bar

php emvicy module:create Bar secondary

How it works

There is a distinction between primary and secondary modules. You create a module by using emvicy on CLI. The creation of the necessary environment config file (e.g. 'develop.php') during this module creation process depends on which MVC_ENV is set in /.env (see /2.x/configuration#Environment).


The primary module

You develop your application in a primary module. That primary module is also stored by name in the globally available config $aConfig['MVC_MODULE_PRIMARY_NAME'] and is also available via Config::get_MVC_MODULE_PRIMARY_NAME(). The primary module is the leading, tone-setting module. You don't need to write secondary modules if you don't need one. Develop your application in a primary module.

dotfile .primary

A primary module needs to have the dotfile .primary in its root folder. There can only be one module having a .primary dotfile at once. If you add a module by following Creating a primary Module, the .primary dotfile will be automatically created. If you want so make a secondary module as the primary one, just move the .primary dotfile to the secondary module.

.primary

A secondary module

Sometimes there are parts of code you want to reuse in other software projects. For such a case secondary modules are suitable. Code written here should be reused in other Emvicy software projects if necessary. For this version of Emvicy there are already some secondary, public Emvicy modules out there for reuse. See "Modules" Section in the Menu.


Conclusion

  • You need to install at least one Module as primary to be able to work.
  • You can only have one primary module at a time.
  • You can have unlimited secondary modules.