Installation and Hello World


Outlast Framework is hosted on GitHub as an open source project. Click below to fork and/or download the most up-to-date release.

Download or fork now on GitHub


Basic installation is easy. Make sure you are running PHP 5.4+ and MySQL 5.5 is recommended for model support (5.6 is not supported). Simply copy all of the files into a folder, visit the folder from your webserver, and follow a few onscreen directions. Once you are done, you can edit site/index.php to enable database support, activate plugins, and turn on/off other features.

Hello World!

Let’s first do the easiest possible form of Hello World!

Open up the default application folder and find the path /app/controller/default.ctl.php. Unless you configure otherwise (rarely would you need to), the root request to your application ( will be routed to the main() method of default.ctl.php. As a model-view-controller (MVC) framework, Outlast Framework will handle routing automatically and expect you to perform any actions related to the request here within the controller methods (such as loading models, displaying a view, etcetc.). Right now our task is simply to modify the default controller’s main method as follows:

function main(){
    print "Hello World!";
    return true;

Now load up the framework from a webserver (either on your localhost machine or a remote one) and you’ll see “Hello World” displayed. Congrats!

Hello World! v2.0

Since the idea of an MVC framework is to completely separate the display (view) from the processing and logic (controller), we’ll typically use a view template file to display stuff instead of print. This is also great because we can take advantage of the superb features offered by the framework’s built-in Django-inspired template system – more on this later…

Let’s create a view file first in /app/view/helloworld.html and add the following text:

<h1>Hello World!</h1>

Now modify the main() method in default.ctl.php as follows to load up the view file:

function main(){
    return $this->zajlib->template->show('helloworld.html');

If you now load up the app via your webserver you’ll notice that you now get the superbly stylized Hello World! text. Notice the $this->zajlib object – this is a special ‘global’ object that you have access to just about anywhere in the framework and this will contain essentially all of the framework-related features, libraries, and helpers.

Finally, here’s an example with a little more utilization of the framework’s template language (by using variables):

// default.ctl.php
function main(){
    $this->zajlib->variable->hellotext = "Hello World!";
    return $this->zajlib->template->show('helloworld.html');
<!-- helloworld.html -->

Here are some things to note:

  • The folders are highly structured, and the structure is required. Views are in /app/view/, controllers are in /app/controller/. This is true in all cases, though with serveral layers may be added via plugins, etc.
  • Class names are required to be in the format given in the default. So default.ctl.php will have a class name of zajapp_default and it will extend zajController. Again, this stuff is standardized and required. You’ll get used to it.
  • You may have noticed the __load() method. This is a so-called magic method (basically an ‘event’ or a ‘hook’) that runs each time ANY of the methods are called in this particular controller. More about this and controllers in general in the next section…

IDE support (code completion)

When starting out with a new API, code completion can be a really useful feature. Fortunately Outlast Framework features full compatibility with JetBrains PhpStorm. No need to install plugins.

Template files do not (yet) have code completion support but its syntax is quite similar to the twig templating engine, so you can use twig support in PhpStorm.

Outlast Web & Mobile Development (c) 2018 | Privacy Policy |