@@ -305,7 +305,35 @@ public static function getConfig(): ConfigurationDriver {
305305 public static function getConfigDriver () : string {
306306 return self ::$ ConfigDriver ;
307307 }
308-
308+ /**
309+ * Initiate main environment variables which are used by the framework.
310+ *
311+ * This method is intended to be called in the index file of the project.
312+ *
313+ * @param string $appFolder The name of the folder at which the application
314+ * is created at.
315+ *
316+ * @param string $publicFolder A string that represent the name of the public
317+ * folder such as 'public'.
318+ *
319+ * @param string $indexDir The directory at which index file exist at.
320+ * Usually, its the value of the constant __DIR__.
321+ */
322+ public static function initiate (string $ appFolder , string $ publicFolder = 'public ' , string $ indexDir = __DIR__ ) {
323+ if (!defined ('ROOT_PATH ' )) {
324+ define ('ROOT_PATH ' , substr ($ indexDir ,0 , strlen ($ indexDir ) - strlen (DS .$ publicFolder )));
325+ }
326+ if (!defined ('APP_DIR ' )) {
327+ define ('APP_DIR ' , $ appFolder );
328+ }
329+ if (!defined ('APP_PATH ' )) {
330+ define ('APP_PATH ' , ROOT_PATH .DIRECTORY_SEPARATOR .APP_DIR .DS );
331+ }
332+ if (!defined ('WF_CORE_PATH ' )) {
333+ define ('WF_CORE_PATH ' , ROOT_PATH .DS .'vendor\webfiori\framework\webfiori\framework ' );
334+ }
335+ self ::initAutoLoader ();
336+ }
309337 /**
310338 * Returns an instance which represents the class that is used to run the
311339 * terminal.
0 commit comments