3. The Buan environment

The primary point of entry to your application is via the index.php gateway script. This contains 4 stages (or runlevels) at which the Buan environment is affected in some way:

<?php
/* Runlevel 0 */
require('/usr/local/buan/buan-core/init.php');

/* Runlevel 1 */
Core::configure(dirname(dirname(__FILE__)).'/config');

/* Runlevel 2 */
Core::boot();

/* Runlevel 3 */
Core::shutdown();
?>

The following sections will describe what's available to you in the Buan environment at each runlevel.

Global configuration variables

At runlevel 0:

  • Nothing

At runlevel 1:

  • core.dir.controllers
    Absolute path to the folder that contains all core Controller classes.
    All of these Controllers can be overridden by controller classes in your application.
  • core.dir.extensions
    Absolute path to the folder that contains all core Buan extensions.
  • core.dir.models
    Absolute path to the folder containing all core Model classes.
  • core.dir.modelManagers
    Absolute path to the folder containing all core ModelManager classes.
  • core.dir.resources
    Absolute path to the folder containing publicly accessible resource files (ie. .../buan-pub)
  • core.dir.views
    Absolute path to the folder containing all core View templates.
  • core.docRoot
    Absolute path to the buan-core folder.
  • core.url.resources
    Absolute URL (excluding domain) to the buan-pub resources folder (ie. the Alias you setup in Apache)
  • timeStarted
    The approximate time at which Buan was first initialised (floating-point timestamp).

At runlevel 2 and runlevel 3, all above plus the following (all of which have more detailed explanations):

  • app.command.default
  • app.command.parameter
  • app.command.requested
  • app.command.urlPrefix
  • app.dir.config
  • app.dir.controllers
  • app.dir.extensions
  • app.dir.ignored
  • app.dir.models
  • app.dir.modelManagers
  • app.dir.temp
  • app.docRoot
  • app.domain
  • app.password
  • app.urlRoot