Routes are registered through multiple ways using either ports or htaccess files. The model-view-controller is a common pattern in framework development. However, wvm windows-view-model or windows-model-view is a routing approach that is built upon the MVC architecture. Both port routing (8080) with php in-built server or the use of third-party webserver is supported by this framework. In order to be more specific, web apps initialized through php local server ports (8080) will be referred to as "MVC Port" while those that uses web servers will be termed as wvm, although, both systems are still under the MVC architecture. The spoova framework has a great relationship with both the Port routing or the use of Htacess file for routing system which makes it possible to interact and work with any of these two systems in an almost similar manner. For example, web page url addresses are configured to give out the same response under any of this systems.

What is wvm ?

The windows-model-view is an architectural pattern built on MVC pattern. It uses a 3-logic pattern to handle url routes, making it a more flexible system to deal with. In wvm, the entire application is the house which has different windows, window frames and entry points. In wvm systems, a window cannot naturally exist unless it is given its own space. The wvm system does not depend on ordinary php files but on window files which in turn serves as entry points. These window files are classes that extends to the root Window class or object. Similarly to a house, a window enables us to have a view and what we see are the models or structures which are accessible through the window. A view cannot occur if there is nothing to be seen. This means that an object must be able to reflect a light. Without a light, then there is no view at all. Hence, wvm is a pattern that follows a window format. A better example is our eyes. When the eyes is opened, a light must be reflected on objects to be seen, else there will be total darkness. The light itself is an object (model) that controls how an object is perceived. So, under wvm, the model comes first before view. The wvm architecture is divided into six categories which are Routes, Frames APIs, Sessions, Rex and Models . These will be discussed later under their headings.

Routing - Template Engines (mvc)
Routing involves management of urls that are later rendered along with template files. Spoova uses an in-built template engine Compiler to render its rex template files. The rex template files are placed within the windows/Rex directory which is the location where all php resource template files (rex) are loaded from. The template files are loaded through the use of Res::load() class which means "load resource". It is very easy to load template files on routes and we will be examining few examples.

Example 1 : Functions

    1. Res::load('index', function(){ return "me"; });
    2. Res::load('index', fn => "me" );
    4. Res::load('::path.of.file', fn => "me" );
    6. Res::load('index', fn => compile() );
    8. Res::load('index', fn => view('some-file') );

In example above, assuming we are within a window file :

In line 1 & 2 above, the index is usually an empty rex file (i.e index.rex.php) which serves as a screen upon which the string value (i.e "me") will be reflected on. This means that index.rex.php must exist within the rex folder for the word "me" to be displayed successfully on the webpage. The supplied empty file path "index" will be used as storage path.

Since creating empty files which are just needed as a screen to reflect our content might not be the best idea, by supplyig a double colon :: and a path on the file just as line 4, the load function will help to push our data to the webpage while the storage file path will also be created. The path after the colon (i.e "path.of.file") will be translated to path/of/file.rex.php which will then be used as the storage file name (or path).

In line 6, the compile() method is used as a directive for rendering the contents of the index rex file. A file will not be rendered unless the compile method is declared upon it.

In line 8, the view() method is used as a directive for rendering the contents of a supplied template file into the index file. In spoova 2.5, the compile() function can be used similarly.

Note: The icore/filebase.php file needs to be included or accessible on all project files. This has been preloaded to all window structure. Hence, if this structure is employed, then there is no further need to include it.

Example 2 : Classes
    1. use spoova\mi\windows\Routes\App;
    3. Res::load('index', [App::class, 'index']);

In example 2 above, we supplied a class using an array. The App class will be loaded from the spoova\mi\windows\Routes namespace and the index method will be called from that App class.
The markup() method is similar to the the load method except that it prevents the compile() function from automatically displaying the content rendered. Instead, it returns the data compiled. Example is shown below:

Example 3 : Markup
    1. include_once 'icore/filebase.php';  
    2. use spoova\mi\windows;
    4. $compiled = Res::markup('index', [App::class, 'index']);
    5. print $compiled;

Accessing files using the window system allows pages to load only through the window classes or routes by calling Server::run() from the index.php file which is connected to an icore/filebase.php file. Hence, line 1 will be naturally available to all window files as long as any of the spoova architectural logics are employed and this means that we don't need to include it. Due to the fact that the root Window class has a great relationship with the Res class, assuming that we are within a window file (or class), then the Res:: class can be replaced with self::
Example 4 : Using window file
    namespace spoova\mi\windows\Routes;

    use Window;

    class Home extends Window {

        function __construct() {

            $arguments = ['title' => 'This is Homepage'];

            self::load('home', fn() => compile($arguments) );



In the example above, not only were we able to use the self::load() inherited compiler but we also passed an argument to the home.rex.php file using the compiler function. You can learn more about port routing or wvm from the supplied links.