Invoker - Philiphil/Kult-Engine GitHub Wiki

#old
#Invoking. The purpose of www\invoker.class.php is to allow every page accessible by a user to use kult engine's features.
In order to do that, you have to use one of invoker's invoking function.

##require_basics require_basics is the main function of invoker, it will invoke a default ke's instance.
It takes 2 arguments, the first one is the relative path between the file using invoker and config.php or an alias.
The second is an array of additional mods to load.

###The first one
By default, config is in .\website\config.php and pages are in .\website\www\pages.php.
In this case, the first one can be '', its an alias to '../'.
'api' is an alias to '../../'

###The second one The second one is for invoking mods.

In order to do so, you first got to make your mod, let's admit you want to name it 'necromancer'
You got to create .\website\controller\mods\necromancer\ folder and .\website\controller\mods\necromancer\necromancer.handler.php
When you invoke necromancer with require_basics, you include .\website\controller\mods\necromancer\necromancer.handler.php

examples :
kult_engine\invoker::require_basics();
kult_engine\invoker::require_basics('', ['necromancer']);
kult_engine\invoker::require_basics('api');

##require_lightweight If you only need a few features from KE, require_lightweight is your guy !
Its basicly the same as require_basics but with a third arg.

The first one, is the first one of require_basics
the third one, is the second one of require_basics
But, the second, is an array of core elements. Here's what to type in order to invoke those elements.

  • 'debugger' : to invoke error handler
  • 'logger' : to invoke log handler
  • 'lang' : to invoke i18n fonctions
  • 'connector' : to invoke db connector
  • 'router' : to invoke REST router
  • 'page' : to invoke html handler
  • 'session' : to invoke session handler
  • 'inquisitor' : to invoke security handler