Application Life Span

Processes that occur starting from the first time you request a page until all response body is successfully rendered to you.

  1. A visitor opens the web page at http://127.0.0.1/article/lorem-ipsum
  2. The web server responds as follows:
    1. Check if a file/folder exists in location .\srv\http\article\lorem-ipsum
      1. If so, load that extension-less file/folder. At this point, Mecha has no role whatsoever, and the application will stop.
      2. Otherwise, the web server will load .srvhttpindex.php file.
        1. Defines core application constants.
        2. Loads .\srv\http\engine\f.php
          1. Defines core application’s functions.
        3. Loads .\srv\http\engine\fire.php
          1. Sets PHP error reporting mode by checking the existence of TEST constant and its truthy value.
          2. Normalizes and evaluates global variables ($_GET, $_POST, $_REQUEST) values.
          3. Normalizes $_FILES values to $_POST for easy array iterations.
          4. Sets up a queue to load class files stored in .\srv\http\engine\kernel folder, efficiently.
            1. Loads related class files stored in .\srv\http\engine\plug folder once the class is loaded.
            2. Loads related class files stored in .\srv\http\lot\x\*\engine\plug and .\srv\http\lot\y\*\engine\plug folder once the class is loaded.
          5. Prepares the enter hook to execute.
          6. Prepares the exit hook to execute.
          7. Loads core application’s state data to variable $state. This should loads the .\srv\http\engine\kernel\state.php file.
          8. Builds up current URL data from the server variables then loads it to variable $url. This should loads the .\srv\http\engine\kernel\u-r-l.php file.
          9. Looks for state.php files in all extension and layout folders and then registers the values to $state->x (for extensions) and $state->y (for layouts).
          10. Sets up a queue to load class files stored in .\srv\http\lot\x\*\engine\kernel and .\srv\http\lot\y\*\engine\kernel folder, efficiently.
            1. Loads related class files stored in .\srv\http\lot\x\*\engine\plug and .\srv\http\lot\y\*\engine\plug folder once the class is loaded.
          11. Looks for task.php files in all extension and layout folders and then loads them.
            1. In case of immediate echo, the enter hook will be executed just before the first echo.
            2. In case of immediate exit, the exit hook will be executed here.
          12. Looks for index.php files in all extension and layout folders and then loads them.
            1. In case of immediate echo, the enter hook will be executed just before the first echo.
            2. In case of immediate exit, the exit hook will be executed here.
          13. Sets default response status to 403 and sets an x-powered-by header with value 'Mecha/3.0.0'.
          14. Sets default response type to 'text/html' (or to 'text/plain' in case of errors).
          15. Sets default application time zone from the $state->zone value.
          16. Loads the core task.php file if any.
            1. In case of immediate echo, the enter hook will be executed just before the first echo.
            2. In case of immediate exit, the exit hook will be executed here.
          17. Clears all temporary global variables.
          18. Executes the set hook. This should loads the .\srv\http\engine\kernel\hook.php file.
          19. Executes the get hook.
            1. In case of immediate echo, the enter hook will be executed just before the first echo.
            2. In case of immediate exit, the exit hook will be executed here.
          20. Executes the let hook.
          21. Executes the exit hook.

Coding Style Guide

My coding preferences on this project you must follow to be able to contribute.

Hook

List of the core hooks and what they do.

Layout

Adds a front view to present the data.

Application Life Span

Processes that occur starting from the first time you request a page until all response body is successfully rendered to you.