Quick links: Content - sections - sub sections
EN FR

Declaring modules

A module is a directory with a precise file-system hierarchy. They are groupped in one or several directories called: modules group.

General configuration

Module groups are declared in the configuration property modulesPath. It's possible to set a value of one or several relative or absolute paths separated by commas. It's possble to use directory codes with a particular notation :

   directorycode:relative/path/

The following directory codes are avalaible :

lib lib/ directory
app application directory

This prevents from having really relative paths and is easier to maintain. For example:


   modulesPath = lib:jelix-modules/,app:modules/

It declares two module groups :

  • jelix-modules, subdirectory of jelix's lib/;
  • modules, subdirectory of your application path.

Modules from both directories are usable and actions they declare will be executable from the client's browser.

Deactivate a module

In a modules group, perhaps there are some modules you don't use, which are not "installed", not configured.

So it is necessary to indicate this modules in order to prevent to access to them through the web, and to prevent other modules to use its ressources.

To indicates this uninstalled modules, you should use the option unusedModules in the configuration. Modules name should be separated by a coma.


unusedModules = "foo,bar"

Here, modules foo and bar are not usable by the application.

Restrictions to some entry points

Sometimes you use and have configured some modules, but you would like to forbid access to this modules from the web, or to restrict the access from specific entry points.

Two configuration options allow to set this restrictions.


   checkTrustedModules = on
   trustedModules = foo,bar,baz

Enabling checkTrustedModules activates the module restriction system. List of permitted modules should be a comma-separated list set to trustedModules.

Other modules won't be accessible to the client; however it's still possible for other modules to access restricted modules resources, such as classes, zones, persistent objects...

If you want to restrict from all entry points, indicate the options in defaultconfig.ini.php, else indicate them in each config.ini.php file of entry points.

Don't forget to configure correctly the url engine, so Jelix could generate modules URLS correctly with their respective entrypoints.

Create a module

It's as simple as creating a sub-directory of a modules group, and filling it with controllers, persistent objects ...

It's simple with jelix's script's createmodule command :


   php jelix.php createmodule mymodule

This command creates the module "mymodule" in your application's sub-directory modules, some sub-directories as well as a default controller.

  • *Important** : The name of modules are used in the name of some classes generated automatically by Jelix. So you mustn't use other characters than a-z, A-Z, 0-9 and '_'.